On Saturday, 9 August 2025 at 04:02:03 UTC, Brother Bill wrote:
I understand that members of various levels can be
distinguished.
What I don't understand is why one would use this technique.
I skipped that part of the question because I thought that the
fact that it's not a shadowing case invalidates it.
To be frank the only time I've ever used that was with OOP and
when a derived class introduced a derived instance of another
class type:
```d
class Declaration {}
class StructDeclaration : Declaration {}
class TypeDeclaration {
Declaration d;
this(Declaration d){
this.d = d;
}
}
class TypeStruct : TypeDeclaration {
StructDeclaration d;
this(StructDeclaration d){
this.d = d;
super(d);
}
}
```
So that whenever you work with a TypeDeclared or one of his
derived class, you known that `d` is of the corresponding Type
with a corresponding level of derivation.
Obviously in this case a system of overlapped field would have
made more sense but that does not exist in D (never seen that
elsewhere either btw).