On 20 April 2010 19:07, Walter Bright <[email protected]> wrote:
> Why use that instead of raw strings?
Because of cases where you have recursive mixins. Eg,
return `mixin("int" ~mixin(\"abc\") ~";)`;
You can use ` `-delimited strings, but only once.
So you end up with some ugly morass of `"` ~ or `\"` everywhere. It
gets quite disgusting.
With enquote, that example is:
return `mixin("int" ~ enquote(mixin("abc")) )`;
Then if you want to put it in another mixin, it becomes:
return `mixin(enquote(mixin("int" ~ enquote(mixin("abc")) ))`;
but without enquote, it is:
return `mixin("mixin(\"int\" ~mixin(\\"abc\\") ~\";)")`;
which is practically unreadable.
>
> Don Clugston wrote:
>>
>> I've found that the function below is invaluable for CTFE programming;
>> it gets rid of a huge fraction of the ugliness.
>>
>>
>
> _______________________________________________
> phobos mailing list
> [email protected]
> http://lists.puremagic.com/mailman/listinfo/phobos
>
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos