Methods in enums

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Tue Aug 15 00:38:38 UTC 2023


On Monday, 14 August 2023 at 23:40:33 UTC, WebFreak001 wrote:
> ...
> They would of course need a bit of new syntax, like possibly 
> separating the enum values and methods with `;`, like what Java 
> does, or having a more D-like syntax that just allows methods 
> anywhere in the enum. I think the concept itself would fit into 
> the language design very nicely.

You could use plain private struct as an enum type, then you'd 
have methods on enum members.

Best regards,
Alexandru.


More information about the Digitalmars-d mailing list