[phobos] expand for std.metastrings
kenji hara
k.hara.pg at gmail.com
Sat Nov 6 05:45:04 PDT 2010
Thanks, Robert.
I think we reached consensus.
Kenji
2010/11/6 Robert Jacques <sandford at jhu.edu>:
> On Thu, 04 Nov 2010 02:06:37 -0400, kenji hara <k.hara.pg at gmail.com> wrote:
>
>>> Personally, I consider comma separated formatting to be inlined, or at
>>> least inline style
>>
>> OK, I call the kind of expand "Embedded Formatting" in this
>> discussion, to avoid confusion.
>>
>> I again want to emphasize with the Need of Embedded Formatting, with some
>> code.
>> If you only use built-in string literals, you can't avoid escaping of
>> code string.
>> ----
>> enum op = "+";
>> enum code = "a "~op~" b";
>> // use "" and manual escaping. It is same with r"" and ``.
>> enum code = mixin(expand!"a $op b");
>> // automatically escaping
>>
>> // quoted string has problem with embedding...
>> enum code = q{
>> struct A{
>> enum str = "hello!";
>> enum val = a }~op~{ b; // invalid! can't embed correctly.
>> }
>> };
>> enum code = "
>> struct A{
>> enum str = \"hello!\"; // manual escaping!
>> enum val = a " ~ op ~ " b;
>> }
>> ";
>> enum code = mixin(expand!q{
>> struct A{
>> enum str = "hello!"; // automatically escaping
>> enum val = a $op b; // automatically embedding
>> }
>> }); // and editor highlighting will mostly succeed.
>> ----
>> I DO NOT want to think about escaping of code string!
>> In this regard, expand is very usuful.
>>
>> Kenji
>
> I just wanted to point out that D has 6 different types of Wysiwyg Strings
> in addition to standard escape based "" strings and the q{} token strings.
> i.e.
>
> enum code = `
> struct A{
> enum str = "hello!";
> enum val = a `~op~` b;
> `;
>
> Anyways, for me, $Type definitely makes expand a worthwhile addition to
> Phobos.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
More information about the phobos
mailing list