Deprecation of implicit string concatenation
Johan Engelen via Digitalmars-d
digitalmars-d at puremagic.com
Sun Apr 2 07:20:17 PDT 2017
On Sunday, 2 April 2017 at 11:44:16 UTC, David Nadlinger wrote:
> On Sunday, 2 April 2017 at 10:55:22 UTC, Johan Engelen wrote:
>> a ~ "abc" "def";
>
> If the order is important, make it `a ~ ("abc" ~ "def")`
> instead. I'd argue that with concatenation usually being
> left-associative, clearly stating the intention to evaluate the
> side first would be a good idea anyway.
>
> But even if you didn't agree with this line of thought,
> wouldn't having to add a pair of parentheses here and there be
> a small price to pay for avoiding a very real source of bugs?
> Or are you just worried about the deprecation message leading
> people into inadvertently introducing a behaviour change when
> they just mechanically applied the fix to the code?
I've been thinking for some time now about making a good code
formatter, and the removal of the automatic concat (and the
necessity of parens) makes automatic reformatting of code _a lot_
harder.
About the deprecation message: perhaps the parentheses should be
included to guarantee no behaviour change. It's important to be
able to trust the compiler.
But I am happy to see some thought went into this:
https://forum.dlang.org/post/ibhug0$3065$1@digitalmars.com
https://issues.dlang.org/show_bug.cgi?id=3827
It'd help to have such links in the release notes or in the
deprecation description.
-Johan
More information about the Digitalmars-d
mailing list