Discussion Thread: DIP 1044--Enum Type Inference--Community Review Round 1

XavierAP n3minis-git at yahoo.es
Mon Nov 28 09:38:12 UTC 2022


On Monday, 28 November 2022 at 07:06:56 UTC, Max Samukha wrote:
>
> Why is that absurd?
>
> This:
> ```
> struct Entity
> {
>     enum Kind
>     {
>     }
>
>     Kind entity;
> }
> ```
> instead of this:
> ```
> enum EntityKind
> {
> }
>
> struct Entity
> {
>     EntityKind entity;
> }
> ```
> is a common practice.

About nesting in general I've replied to ryuukk_ at 
https://forum.dlang.org/post/gjhvbrehodkabzvewopx@forum.dlang.org

In this example there's little difference, between having to type 
(or not) either `Entity.Kind` or `EntityKind`. It's indeed a good 
example how nesting without private data is a purely stylistic 
namespacing choice. (So imo no one forces you to use it to an 
extent that requires you to type too much or otherwise makes your 
life difficult.)


More information about the Digitalmars-d mailing list