Does D have too many features?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Apr 28 21:41:20 PDT 2012


On 4/29/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> But it does allow for some neat tricks

See, this is in RABCDAsm:

auto pvalue = name in vars;
if (pvalue is null)
    throw new Exception("variable " ~ name ~ " is not defined");
string value = *pvalue;

And it can be replaced with one line of code:

string value = *enforce(name in vars, "variable " ~ name ~ " is not defined");


More information about the Digitalmars-d mailing list