Shopping for template languages
cc
cc at nevernet.com
Wed Aug 14 13:30:25 UTC 2024
On Monday, 12 August 2024 at 11:47:54 UTC, IchorDev wrote:
> It would be too ambiguous. If you write a type-inferred enum
> member that has the same name as a local variable, what
> happens? The fact that there’s more than one answer means that
> the programmer can’t be certain without looking it up; wasting
> their time to use a convenience feature.
I scold myself for using a local variable named the same as an
enum member. s'why I like to use all caps for my enums, saves my
valuable time so I don't have to look things up ;)
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"
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
then cast the local to its own type to force it to compile.
> Well you’re welcome to submit a new PR for the existing
> implementation but with it locked behind a preview…
Will take me a minute to get up to speed on mucking with the
compiler but maybe I'll give it a shot next rainy afternoon
More information about the Digitalmars-d
mailing list