digitalmars.D - More Uniform Syntax for Operating on Types aswell as Values
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (15/15) May 08 2014 The more I use generic programming in D the more I long for a
The more I use generic programming in D the more I long for a more uniform syntax for operating on types. One improvement could be to make, for instance, enum isArrayOf(T, U) = isArray!T && is(ElementType!T == U); which is used as isArrayOf!(T, string) instead be expressed as, for instance, T.!isArrayof!(string) or, in this binary case, even simpler T.!isArrayof!string where .! is a new operator. Have anybody discussed or even proposed such an extension? I haven't thought about operator associativity and precedence. Maybe my example is plain, wrong syntatically :) Destroy!
May 08 2014