DIP19: Remove comma operator from D and provision better syntactic support for tuples
Andrej Mitrovic
andrej.mitrovich at gmail.com
Tue Sep 25 08:51:46 PDT 2012
On 9/23/12, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP19
Oh, I completely forgot to mention this little bug I've had due to the
comma operator a few weeks ago:
import std.stdio;
int getInt(string op)
{
if (op, "a")
return 1;
else
if (op == "b")
return 2;
else
return 3;
}
void main()
{
string op1 = "a";
string op2 = "b";
string op3 = "c";
writeln(getInt(op1));
writeln(getInt(op2));
writeln(getInt(op3));
}
It was a result of a refactoring and the bug went unnoticed until I
started getting weird results back. The if/else was much bigger and
the comma was somewhere in the middle. So yeah, nuke it from orbit!
More information about the Digitalmars-d
mailing list