Are Delimited strings and HereDoc strings just here to suck ?

Klaus via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 11 14:05:36 PDT 2014


On Monday, 11 August 2014 at 20:10:47 UTC, H. S. Teoh via 
Digitalmars-d-learn wrote:
> On Mon, Aug 11, 2014 at 07:47:44PM +0000, Klaus via 
> Digitalmars-d-learn wrote:
>> I mean when writing a D lexer, you necessarly reach the moment 
>> when
>> you think:
>> 
>> "Oh no! is this feature just here to suck ?"
>
> I use heredocs every now and then when I need to embed long 
> strings in
> my program. It's one of the things I *like* about D, in fact. 
> Nobody
> wants to manually parenthesize every quoted line with '"...\n"' 
> when the
> program need to incorporate several pages of built-in help 
> text, for
> example.
>
> Delimited strings are useful when writing code/text generators 
> when you
> need to be able to use ' and " as literal characters without 
> crazy
> leaning-toothpick syndrome \"x\"y\"z\"w\"'s sprinkled 
> everywhere.
>
> The crazy variety of ways to write string literals in D, OTOH, 
> *is* a
> bit over the top, as I found out myself when I also tried 
> writing a D
> lexer.  :-P
>
>
> T

Yep I think you get what I mean: "clearly over the top", 
particularly when each element of your arm is 50% over the top 
and then when you try to show the top with an over-sized arm then 
it's clearly an "over-toped position".



More information about the Digitalmars-d-learn mailing list