Thread overview
[Issue 16602] Implicit string concatenation and precedence of ~
Oct 07, 2016
Jonathan M Davis
Oct 07, 2016
Andrej Mitrovic
Oct 08, 2016
Jonathan M Davis
Oct 10, 2016
Andrej Mitrovic
Nov 25, 2016
Joseph M Rice
Dec 17, 2022
Iain Buclaw
October 07, 2016
https://issues.dlang.org/show_bug.cgi?id=16602

Jonathan M Davis <issues.dlang@jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang@jmdavisProg.co
                   |                            |m

--- Comment #1 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
Okay. What's the bug? There has been talk of making it so that expressions are always evaluated left-to-right, but AFAIK, it's still the case the order of evalutation is undefined. So, ~ is behaving perfectly normally. You might as well complain that

import std.stdio;

int foo(int i, int j)
{
    return i * j;
}

void main ( )
{
    writeln(42 + 10 * 19);
    writeln((42 + 10) * 19);
    writeln(42 + 10.foo(19));
}

prints

232
988
232

instead of
232
988
988

With the implicit string concatenation, it basically treated the strings as one giant string, and concatenated them at compile time. ~ on the other hand would only be compile time if it's optimized to be that way. So, they've never had the same semantics, and it doesn't make sense for them to.

So, while I grant you that this shows that simply replacing an implicit string concatenation with an explicit one is not necessarily the correct fix for code that uses implicit string concatenation, I don't see how that's a bug.

--
October 07, 2016
https://issues.dlang.org/show_bug.cgi?id=16602

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Right, but I think we should add this note to the changelog. I'm changing the issue to be an enhancement.

--
October 08, 2016
https://issues.dlang.org/show_bug.cgi?id=16602

--- Comment #3 from Jonathan M Davis <issues.dlang@jmdavisProg.com> ---
I totally agree that this should be put in the changelog, since the difference is not necessarily, immediately obvious, but I don't think that there's actually a bug here or that there's a problem with ~.

--
October 10, 2016
https://issues.dlang.org/show_bug.cgi?id=16602

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|dmd                         |dlang.org

--
November 25, 2016
https://issues.dlang.org/show_bug.cgi?id=16602

Joseph M Rice <ricejm01@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ricejm01@gmail.com

--- Comment #4 from Joseph M Rice <ricejm01@gmail.com> ---
I actually have to complain about this whole thing. In C/C++, Java, C# and virtually every programming language based on the C syntax allows for implicit string concatenation.

Allowing this to be depreciated you are making the D language harder to use.

the rationale for the reasoning for why all of sudden we have to start using ~ to break up long strings so that the code is readable is quite frankly Bullshit!

Case in point.

this:

string[] names =
[
    "Anna",
    "Michael"
    "Emma",
    "David"
];
// The content of arr is [ "Anna", "MichaelEmma", "David" ]

Vs.

string aReallyLongString = "this is a really long string that will"
                           "not look good on the page if it put on"
                           " a single line";


There is a huge difference between Array assignment and single string assignment.  How about you revert the changes in 2.072 and re-implement to fix the actual problem, which solely with array assignment and look for '[' ']' characters to not allow implicit string concatenation.

At this point 2.072 is not usable, and I would appreciate not having to fix ~20,000 lines of code to add '~' everywhere.   Not to mention you just broke almost every dub library I use as well.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=16602

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 15
https://issues.dlang.org/show_bug.cgi?id=16602

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dlang.org/issues/3960

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--