On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
See email: 'with(Foo):' not allowed, why? in
No other statement construct works like that, there doesn't
seem to be much point to adding such a special case.
Guess it depends on the type. with(): would act a lot like
private/public labels. I can see uses; Although it would mostly
be to keep code cleaner rather than adding more functionality.
Depends on how many pesky extra braces you want to avoid...
enum Flags {a,b,c,readonly,write,etc}
void func(Flags f){
switch(f) {
with(Flags): //or put this outside the switch...
case a: //Flags.a:
case b: //Flags.b:
case c: //Flags.c:
case readonly: //Flags.readonly:
case write: //Flags.write:
}
}
Honestly i'd probably want to use multiple enum types at the
same time, so it would be with(type1,type2,type3, etc):. This
assumes it doesn't clash in the following code. However i don't
NEED it to work...