2 ms·
Thanks for clarifying that; I was actually aware of the link to syntactic sugar and it's probably true that you want to control that independently. After all, w
by seertaak 7y ago
Thanks for clarifying that; I was actually aware of the link to syntactic sugar and it's probably true that you want to control that independently. After all, who doesn't want to hijack unary minus for the purpose of as hackneyed rendering of EBNF? C++ certainly does it :)
Anyway a serious answer to your comment would be to create a field or ring concept. This would unify some or all of the arithmetic operations.
A neat bonus would be the ability to overload the one and zero literals for the set. So in field of nxn matrices on real numbers 0 is the zero matrix and 1 is the identity.
- steveklabnik 7y ago> After all, who doesn't want to hijack unary minus for the purpose of as hackneyed rendering of EBNF? Ha! > Anyway a serious answer to your comment would be to create a field or ring concept. Yeah, this is true. We really, really struggled to create a set of traits for numerics, even regardless of these more advanced ideas... so it's unclear this would work. But it's certainly closer than I had thought :)