[Issue 16602] New: Implicit string concatenation and precedence of ~
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Oct 7 12:37:44 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16602
Issue ID: 16602
Summary: Implicit string concatenation and precedence of ~
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
In the upcoming version of DMD implicit concatenation of strings is deprecated.
However, simply adding ~ may not lead to the same semantics as before. Observe:
-----
import std.stdio;
import std.string;
void main ( )
{
string a = "some %s format "
"string".format("nice");
writeln(a); // ok
string b = "some %s format " ~
"string".format("nice"); // exception thrown
writeln(b);
}
-----
In the second example format() is called before the two strings are
concatenated.
--
More information about the Digitalmars-d-bugs
mailing list