Kill implicit joining of adjacent strings

Yao G. yao.gomez at spam.gmail.com
Wed Nov 10 19:36:59 PST 2010


On Wed, 10 Nov 2010 20:34:07 -0600, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Do you seen anything wrong in this code? It compiles with no errors:
>
> enum string[5] data = ["green", "magenta", "blue" "red", "yellow"];
> static assert(data[4] == "yellow");
> void main() {}
>
>
> Yet that code asserts. it's an excellent example of why a sloppy  
> compiler/language sooner or later comes back to bite your ass.

Stop blaming the compiler for your own carelessness.

>
> In C the joining of adjacent strings is sometimes useful, but explicit  
> is better than implicit, and D has a short and good operator to perform  
> joining of strings, the ~, and D strings are allowed to span multi-lines.

I find it useful, and I like it. I like to break long strings into smaller  
ones
and put each one in one line. I know that you can do that using one single  
string, but
some syntax hightlighters don't like it that way.

> Despite Walter seems to ignore C#, C# is a very well designed language,  
> polished, and indeed it refuses automatic joining of adjacent strings:
> [...]
> This is one of the about twenty little/tiny changes I am waiting for D.

Maybe you should switch to C# :)

> So please kill automatic joining of adjacent strings in D with fire.

No.

> Thank you,
> bearophile


-- 
Yao G.


More information about the Digitalmars-d mailing list