On 11/23/13 12:55 PM, bearophile wrote:
But both workarounds are bad when you have many items, a long name for
the typedef, or your T is the type of the keys or values of an
associative array.

Can this situation be fixed/improved?

Typedef!T is meant as a type with the same behavior as T, but otherwise unrelated to it. The code above suggests it behaves as advertised. Allowing uncontrolled conversions to and fro is only making typedef weaker. Asking for features just because "they worked with typedef" is unlikely to fare well because typedef was just a weird artifact with arbitrary semantics that were nice half the time and darn surprising the other half.

We could add a flag such that Typedef!(T, supertype) that allows T as a supertype, i.e. add an alias this. There is no possibility to add implicit construction of Typedef!T from T (and that's arguably a good thing).


Andrei

Reply via email to