Library Typedefs are fundamentally broken

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Sep 19 23:50:26 PDT 2014


On Saturday, 20 September 2014 at 04:52:58 UTC, Andrei 
Alexandrescu wrote:
> This is wrong but probably not worth fighting. Consider:
>
> alias A = Typedef!float;
> alias B = Typedef!float;
>
> By basic language rules, A and B are identical. Making them 
> magically distinct would be surprising and would require 
> explanation. It's as if someone writes:
>
> struct Point { int x, y; }
> alias A = Point;
>
> and then later in the same module
>
> alias B = Point;

But Typedef is not some generic symbol. It is library type 
specifically introduced as `typedef` keyword replacement and 
advertised as such. I expect it to work as close to `typedef` as 
possible being the most priority. Otherwise it is simply useless.

>> I.e. Typedef is fail. Won't use.
>
> Typedef is win. Feel free to not use.

Thanks for permitting, this is exactly what I will do.


More information about the Digitalmars-d mailing list