4 ms·
It appears to only be primarily useful if you are writing a pure wrapper class where you proceed to delegate to an actual implementation. But you could still d
by kllrnohj 8y ago
It appears to only be primarily useful if you are writing a pure wrapper class where you proceed to delegate to an actual implementation.
But you could still do that and not be string-based. It could (and should!) be an enum of the operator instead. opBinary takes a fixed number of ops, but the parameter type of string has an infinite number of values.
Whether or not the design of having a single operator overload method is a good idea or not is independent from what I'm specifically calling insane which is that the parameter type to that method is a string.
- p0nce 8y agoIf it is string-based meta-programming you find ugly (as many do as first), consider the alternatives are maybe not much better in practice. https://forum.dlang.org/post/l5srs7$2m3$1@digitalmars.com https://forum.dlang.org/post/l5srs7$2m3$1@digitalmars.com