Methods in enums

sighoya sighoya at gmail.com
Fri Aug 18 20:27:07 UTC 2023


On Friday, 18 August 2023 at 16:30:00 UTC, user1234 wrote:
> Yes. The metaprog in the mixin hides the import, just like what 
> will do a compiler.
> "I can find this, but is this result correct given the scope ?".

Good idea. There are some points which suck however:
- additional code generation time
- enum variable declarations need separate mixin call to include 
ufcs as well.

I think maybe a more general case allowing importing a type with 
ufcs methods as well would be a better solution.

However, for methods associated to the enum type instead of the 
enum value it would be better to allow them to be included in the 
enum akin how we do it with structs.



More information about the Digitalmars-d mailing list