I believe typedef was deprecated due to no-one being able to agree on the semantics (although it's a bit before my time). I think it needs to come back as a very simple concept:

A type duplication. e.g. typedef int myInt; (or typedef myInt = int;) creates a new type that is exactly identical to int, but is a distinct type in the type system.

It should provide *exactly* identical behaviour to e.g. having two structs with identical contents but different names. E.g.

struct A{}

typedef A tA;
alias A aA;
alias tA atA;
typedef aA taA;

assert(!is(tA == A));
assert(is(aA == A));
assert(is(atA == tA));
assert(!is(taA == atA));
etc....

It's a really basic feature that D ought to have.

I don't understand the difference to alias myInt = int;
Isn't it the same?

Reply via email to