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

Walter Bright newshound2 at digitalmars.com
Sat Nov 19 03:46:55 UTC 2022


On 11/18/2022 7:09 PM, 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.


True, but you could also do:

with (MySuperLongType):  // <= note colon
MySuperLongType flag = ValueA | ValueB | ValueC | ValueD | ValueE | ValueF |
  ValueG;


> Of course, you may be able to just extend the scope to cover the usage point as 
> well.

Yup.


More information about the Digitalmars-d mailing list