Using . notation abstractly

Paul Backus snarwin at gmail.com
Fri Oct 12 12:43:53 UTC 2018


On Wednesday, 10 October 2018 at 22:56:14 UTC, James Japherson 
wrote:
> The point of all this is because D does not allow nesting of 
> enums
>
> which allows for nice use of . to separate hiearchies:
>
> enum A
> {
>    enum B
>    {
>       X,
>    }
> }
>
> A.B.X, rather than having to have one large flat enum and do 
> things like A_B_X.

You can use a mixin template to introduce a new namespace:

https://run.dlang.io/is/K0kJJl




More information about the Digitalmars-d-learn mailing list