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

bauss jacobbauss at gmail.com
Mon Nov 21 09:25:53 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":
>

Not a fun of it using $identifier to imply inference.

I would much rather like .identifier.

I know that is currently used for module scope, but it could have 
been changed to something like static interference instead, so it 
will default to module scope, but can look into other types like 
enum, static members of classes etc.

Basically:

```d
int a = 1;
class B {
   static:
   int b = 2;
}
enum MyEnum { c = 3 }
void main()
{
   writeln(.a);
   writeln(.b);
   writeln(.c);
}
```

Output:

```
1
2
3
```

Basically module scope has first priority, second enum, third 
static members.

So an ambiguity error shouldn't happen if a module scoped 
variable is named the same as an enum member etc.



More information about the Digitalmars-d mailing list