Alias example should supposedly be illegal, but runs fine

codephantom me at noyb.com
Tue Dec 19 01:08:25 UTC 2017


On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote:
>
> alias a = s.i; // illegal, s.i is an expression


alias a = s.i; (this is an alias to a type, since s.i is an int)

Hence it is actually 'legal', as far as I understand.

i.e... "AliasDeclarations create a symbol that is an alias for 
another type, and can be used anywhere that other type may 
appear. "

What is 'illegal', is an alias to an expression.. for example:

alias strlen = string.sizeof;



More information about the Digitalmars-d-learn mailing list