aarti_pl: > T opInfix(string op)(T rhs) { ... } > T opPrefix(string op)(T rhs) { ... } > T opPostfix(string op)(T rhs) { ... }
So you can use opInfix to define operators like a ~~ b :-) Now you just need a way to define operator precedence level, with an int number in 0-14 and you're done (I don't think you need to specify operator associativity if left-to-right/right-to-left) :-) T opInfix(string op, int prec)(T rhs) { ... } There programming languages that allow to specify operator precedence level too, but I think this is overkill in D. Regarding operators, in D they are named according to their purpose and not according to their look, and I think this is a good idea. But opDollar doesn't follow that, so isn't a name like opEnd better? Bye, bearophile