foo!(bar) ==> foo{bar}

Ary Borenszweig ary at esperanto.org.ar
Mon Oct 6 14:57:03 PDT 2008


superdan escribió:
> bearophile Wrote:
> 
>> Walter Bright:
>>> The foo.(bar) syntax seems to be sinking.
>> The Foo{bar} syntax looks nice enough, it's a char long, and I presume q{int} isn't a problem, but from 30 answers seems people don't see problems in the old syntax. So it's not sinking at all.
> 
> relax. he said the pissed pirate is sinking not the slashed pissed fella.
> 
> q{int} is a problem.
> 
> template q(T) { enum q = "eh"; }
> writeln(q{int});
> 
> tat prints eh or int?

It prints "int", of course. q{int} is already evaluated at the lexical 
pass, so the parser sees:

writeln("int");

I don't see it is such a big deal. Why would you define a template named 
q anyway? No one will be bitten by that.

Although I know it's inconsistent... it's not "nice".

But !() is about to change in D2, why not change q{}, which is also D2 only?



More information about the Digitalmars-d mailing list