On 08/31/2016 04:44 PM, Ethan Watson wrote: > http://dlang.org/deprecate.html#typedef > > "typedef is not flexible enough to cover all use cases. This is better > done with a library solution." > > [Citation needed] > > What use cases is it not flexible enough for?
It has unadjustable semantics that were both more restrictive than alias and at the same time not restrictive enough to introduce completely new type. Wasn't supposed to be compatible with base type but sometimes did, with no reasons other than "historical". In my own experience creating dedicated struct type is always superior to typedef if you want to go for type safety. It can start with simple `alias this` struct to have permissive semantics similar to old typedef and later changed to operator overloading for more fine tuned control. It can also provide methods for verified conversion between base type and new domain type. And if type safety is not a goal, there isn't much point in all the typedef restrictions and alias should do as well.
signature.asc
Description: OpenPGP digital signature
