Can we have this Syntactic sugar.

Nick Sabalausky a at a.a
Tue Nov 24 08:17:19 PST 2009


"Steven Schveighoffer" <schveiguy at yahoo.com> wrote in message 
news:op.u3woiqnyeav7ka at localhost.localdomain...
> 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.
>

Well yea, that's the part I was referring to.





More information about the Digitalmars-d mailing list