Discussion Thread: DIP 1044--Enum Type Inference--Community Review Round 1

IchorDev zxinsworld at gmail.com
Sun Nov 20 16:24:24 UTC 2022


On Saturday, 19 November 2022 at 03:09:26 UTC, Adam D. Ruppe 
wrote:
> On Saturday, 19 November 2022 at 02:57:27 UTC, Walter Bright 
> wrote:
>> with (MySuperLongType)
>> MySuperLongType flag = ValueA | ValueB | ValueC | ValueD | 
>> ValueE | ValueF | ValueG;
>
> `flag` is now inaccessible since `with` creates a new scope.
>
> Of course, you may be able to just extend the scope to cover 
> the usage point as well.

This is why I actually avoid `with` to some degree. For the 
everyday occurrences of enums in constructors and function args 
scattered all over my code it's not useful compared to omitting 
the enum type... in fact it's just worse, so I also haven't found 
many great situations to use `with` for either.


More information about the Digitalmars-d mailing list