Can we have this Syntactic sugar.

bearophile bearophileHUGS at lycos.com
Tue Nov 24 07:42:05 PST 2009


Nick Sabalausky:
> That's a very good idea, I like that a lot.

I don't understand that idea yet, sorry :-)
Is that proposal asking for sugar to write:
enum Option { X, Y, Z }
Option.X | Option.Y | Option.Z
As:
Option(X | Y | Z)
?

Or is it asking for something more, like omitting the class name inside the argument list of the call to the constructor?

This syntax is currently available, but it's not handy in that case:
with(Option) { auto x2 = X | Y | Z; }

Bye,
bearophile



More information about the Digitalmars-d mailing list