Discussion Thread: DIP 1044--Enum Type Inference--Community Review Round 1
ryuukk_
ryuukk.dev at gmail.com
Sun Nov 20 19:56:29 UTC 2022
On Sunday, 20 November 2022 at 18:03:04 UTC, H. S. Teoh wrote:
> On Sun, Nov 20, 2022 at 03:31:44AM +0000, ryuukk_ via
> Digitalmars-d wrote: [...]
>> ```D
>> MySuperDuperLongEnum stuff = MySuperDuperLongEnum.VALUE_A;
>> ```
>
> Why not just write:
>
> auto stuff = MySuperDuperLongEnum.VALUE_A;
>
> ? No repetition necessary.
```D
struct Data
{
MySuperDuperLongEnum flags;
}
Data data = {
flags: .VALUE_A | .VALUE_B
};
```
> [...]
>> why should i use an alias here?
>> ```D
>> ctx.network_state = State.NetworkState.CONNECTED;
>>
>> // vs
>>
>> ctx.network_state = .CONNECTED;
>> ```
>
> Walter's proposal of implicit `with` would solve this case.
>
>
> T
Implicit is indeed a good idea, Adam's idea is also interesting
More information about the Digitalmars-d
mailing list