Shopping for template languages

IchorDev zxinsworld at gmail.com
Wed Aug 14 14:43:53 UTC 2024


On Wednesday, 14 August 2024 at 13:30:25 UTC, cc wrote:
> I scold myself for using a local variable named the same as an 
> enum member.

You and no one else, you do it to yourself.

> Worst worst case scenario is the user has a local variable of 
> the same type as the enum itself with the same name as one of 
> the enum members in which case he needs to be smacked and made 
> to stand in the front of the class for doing something so silly.

And apparently there are no women in the field of computer 
science.

> But the compiler already yells at people for ambiguous function 
> usage anyway, worst case scenario is you just have it bark 
> "assigning symbol x to enum type conflicts with local variable 
> x, please use explicit enum reference y.x or cast(y) x to use 
> local variable"

Now let’s try to use the same syntax for type-inferred struct 
constructors:
```d
MyStruct s = (1, 2, 3);
```
Oh look, a comma expression!


More information about the Digitalmars-d mailing list