May 08, 2014 More Uniform Syntax for Operating on Types aswell as Values | ||||
---|---|---|---|---|
| ||||
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! |
Copyright © 1999-2021 by the D Language Foundation