I often come accros the following construct that I don't quite grasp in a D2 source code:
alias uint SymbolRef;
struct SymbolTable {
alias entries this;
SymbolRef startSymbol;
Symbol[] entries;
}
What does imply the alias entries this;
inside the type definition given that there is already Symbol[] entries;
?
In short: alias this construct is D's way of multiple implementation inheritance. In your example struct SymbolTable should behave similarly to Symbol[] with addition of few extra stuff. It can be implicitly converted to Symbol[].
However, I have often heard that more complex usage of alias this is considered buggy in current compiler implementation, so better be careful here and ready for bug reports ;)
Related chapter of "The D Programming Language" is "6.13 Multiple Subtyping"