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

Nick Treleaven nick at geany.org
Sun Nov 27 16:09:11 UTC 2022


On Sunday, 27 November 2022 at 03:17:45 UTC, cc wrote:
> `$_` is the default variable in perl (or was).  I can 
> potentially envision people using `_` as an iterator, match 
> result, bitfield padding variable, etc.  Whether that's a big 
> enough issue worth worrying about, eh.

Fair point, we would have to see how much code uses it. I don't 
think it's common in D.

> Though it does seem odd have to make the exception "`_` is a 
> word character, you can use it in any symbol name, except by 
> itself."  Suppose that's essentially the same situation for 
> keywords, though.

I wasn't necessarily arguing that underscore should not work as a 
variable name, just that accessing `_.foo` should try to match an 
enum member *when an enum member is expected* rather than a 
member of whatever `_` would otherwise evaluate to. I doubt that 
would break code.


More information about the Digitalmars-d mailing list