https://issues.dlang.org/show_bug.cgi?id=12461
--- Comment #3 from Andrej Mitrovic <[email protected]> --- (In reply to bearophile_hugs from comment #2) > (In reply to Andrej Mitrovic from comment #1) > > > But I'm not sure if this is the appropriate fix. > > Do you have a better idea? > > In Haskell this doesn't compile (newtype is a built-in that is similar to > Typedef). > You have to ask the compiler to activate the arithmetic operations between > two newtypes. Sounds like a more configurable and complex version of Typedef. Note that 99% of the work of Typedef is done by Proxy, Typedef simply stores a Proxy inside and otherwise has a very minimal implementation. Anyway I could imagine there is a million little ways you could configure a Typedef, but maybe it's best to have the scaffolding available as a set of mixin templates, so the user can easily create their own specific versions, e.g.: struct UserTypedef(T) { mixin MixOverload!"opUnary"; // implement opUnary mixin MixOverload!"opBinary"; // implement opBinary } This is probably simpler than having a super-complicated generic Typedef structure such as: struct Typedef(bool useOpUnary, bool useOpBinary, ...); --
