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

bachmeier no at spam.net
Fri Nov 18 18:32:44 UTC 2022


On Friday, 18 November 2022 at 15:37:31 UTC, Mike Parker wrote:
> ## Discussion Thread
>
> This is the discussion thread for the first round of Community 
> Review of DIP 1044, "Enum Type Inference":

[...]

I'm skeptical that adding this type of complexity to the language 
is worth it. Not just that this would add considerably to the 
learning curve, but because seemingly harmless changes to another 
part of your program would suddenly introduce ambiguity and cause 
it to no longer compile.

Consider this example:

```
import std;

enum JavaStyleGinormousName { a, b, c, d}

void main() {
     auto var = JavaStyleGinormousName.a;
     writeln(var);
     alias B = JavaStyleGinormousName;
     auto var2 = B.a;
     writeln(var2);
}
```

This makes everything explicit, with no surprises and no 
additional learning curve for the new user. This proposal 
essentially boils down to an implicit

```
alias $. = [something inferred by the compiler depending on the 
context
```



More information about the Digitalmars-d mailing list