@kboyd@alessandrolai I have a couple in a feature dev branch at work. Gotta admit they’re pretty damn nice to code with, way better than const ints. Only gripe I have so far is that I can’t put them into log messages or context or even simple echos without doing some kind of special one off weirdo function on it and calling that. One of the few places I want a $@&*^£ magic __toString() but we can’t have it. :(
@cabbey@kboyd aw crap, it's covered in the original RFC:
"However, implicit magic method calls such as ArrayAccess on enums are not allowed in static or constant definitions as we cannot absolutely guarantee that the resulting value is deterministic or that the method invocation is free of side effects. Function calls, method calls, and property access continue to be invalid operations in constant expressions."
@alessandrolai@kboyd yeah. I just think that restriction was implemented a little too tightly. :( non static or const contexts got the short end of that deal imho, but I dunno what kind of gymnastics the internals would require to allow what I want. And I worked around it with a custom instance method that I needed for other purposes anyway. 🤷
Add comment