DIPX: Enum Literals / Implicit Selector Expression

ryuukk_ ryuukk.dev at gmail.com
Fri Jul 1 12:14:20 UTC 2022


On Friday, 1 July 2022 at 04:50:39 UTC, Walter Bright wrote:
> On 6/30/2022 2:08 AM, Ogi wrote:
>> I was under impression that this is a deliberate (although 
>> questionable) design to avoid some bugs rather some technical 
>> limitation.
>
> It is deliberate, not a bug. The rationale is the common C 
> practice:
>
>   enum XX { XXabc, XXdef, XXghi };
>
> where the programmer is using a workaround for a scoped name.

The proposal is not to mimic C, is to make use of the type system 
so we get to remove the unnecessary verbosity

If `.` is not the way to go, what about:

`set_flags(_.FLAG_A | _.FLAG_B)`

or

`set_flags(with(FLAG_A | FLAG_B))`

or

`set_flags(auto(FLAG_A | FLAG_B))`


More information about the Digitalmars-d mailing list