Subtyping of an enum

XavierAP n3minis-git at yahoo.es
Mon Apr 15 12:38:59 UTC 2019


On Monday, 15 April 2019 at 10:34:42 UTC, Anton Fediushin wrote:
>
> The problem here is that I want to keep methods that are 
> related to an enum inside of this enum for purely aesthetic and 
> organizational purposes.
> ...
> These global functions pollute global namespace.

If you have defined `x.toString` as a method, UFCS means of 
course you can also call `toString(x)`... So it's debatable what 
polluting means.

More generally you insist on modules and namespaces to be 
different concepts, which they are (pointlessly) for C++, but not 
for D (purposely).


More information about the Digitalmars-d-learn mailing list