DIPX: Enum Literals / Implicit Selector Expression

ryuukk_ ryuukk.dev at gmail.com
Thu Jun 30 11:40:31 UTC 2022


On Thursday, 30 June 2022 at 11:32:06 UTC, Mike Parker wrote:
> On Thursday, 30 June 2022 at 11:26:01 UTC, ryuukk_ wrote:
>
>>
>> This is exactly why we need it to be implemented, to avoid 
>> putting things in the global scope and therefore leaking
>
> I think "need" is a strong word here. I'm arguing we don't 
> "need" it. I understand some people want it.
>
>>
>> It better to make use of the type system and be a little more 
>> cleaner without having to rely on mixin/template/imports
>>
>> It should just work
>
> Why should it just work, though? What justifies the potential 
> confusion of having two different meanings for `.foo` when we 
> already have `with`, and `auto`, and the ability to mixin 
> aliases for those who really, really, want it.
>
> To be clear, I do think adding this feature with the proposed 
> syntax would be a mistake because it's one more potential point 
> of confusion for new users. But on a personal level, I'm 
> ambivalent. If it were added, I'd say "meh" and move on. I'm 
> just pushing for some strong justification.


``.foo`` is just syntax, it could be ``_.foo``


It's like

```int myInt = int(42);```


Why do i need to be repetitive here?

Also the goal is not to remove the ability to do 
```Color.orange``` it is to leverage the type system to avoid 
having to be repetitive when it is not needed, like in the flags 
example


```MyFlags flags = .A | .B | .C | .D | .E | .F;```






More information about the Digitalmars-d mailing list