Allow static methods and fields for enum?

pineapple via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 26 03:10:45 PST 2017


On Thursday, 26 January 2017 at 06:40:59 UTC, drug wrote:
> 26.01.2017 09:32, Profile Anaysis пишет:
>> Why not make enum a comparable type to structs and classes?
>>
>> They are static so they can't contain any mutable fields but 
>> surely they
>> can contain methods? And especially they should be able to 
>> contain
>> static methods!?
>>
>>
>>
> What prevents you from using UFCS with enum members or 
> templates with enum itself? (not tested)

This is one solution, but it would still be useful as an 
organizational tool to be able to put those methods in the enum's 
own namespace.


More information about the Digitalmars-d mailing list