Can we have this Syntactic sugar.
Steven Schveighoffer
schveiguy at yahoo.com
Tue Nov 24 07:41:04 PST 2009
On Tue, 24 Nov 2009 10:26:08 -0500, Nick Sabalausky <a at a.a> wrote:
> "Long Chang" <changedalone at gmail.com> wrote in message
> news:mailman.499.1259061212.20261.digitalmars-d at puremagic.com...
>> class RegExp
>> {
>> enum Option{
>> X, Y, Z
>> }
>> int options;
>> this(int options = 0){ this.options = options; }
>> }
>>
>> void main(){
>> auto reg = new RegExp("^A.", .Option( X |Y|Z ) );
>> assert( RegExp .Option.X | RegExp .Option.Y| RegExp .Option.Z ==
>> reg.options );
>> }
>>
>
> That's a very good idea, I like that a lot.
The .Option is already taken, it means "look in the global scope".
However, doing RegExp.Option(X|Y|Z) would be cool.
-Steve
More information about the Digitalmars-d
mailing list