| ▲ | pron a day ago | |||||||
Note that it's not that Zig is opposed to (user-controlled) operator overloading; it's opposed to (user-controlled) overloading of all symbols: The resolution of `foo` in `foo(x)` should not depend on the type of `x`. The issue is not the operators but the overloading, and Zig wants to prevent (user-controlled) overloading of any kind. This makes some things less convenient and other things more convenient. | ||||||||
| ▲ | tialaramex a day ago | parent [-] | |||||||
> The resolution of `foo` in `foo(x)` should not depend on the type of `x` This depends on how you're squinting at this word "resolution". Remember on a modern CPU an XOR R1 R1 does not result in an ALU operation, the decoder understands this idiom and just renames a zero'd register as R1, whereas of course it can't do that for say XOR R2 R3 because that's an actual XOR operation. So if "resolution" means "exactly what happens on the CPU" apparently there is no such facility provided even in assembler. So apparently we mean only that it should have, in some sense, the same effect. I think the fact Rust is OK with
.. meets this criterion, whereas presumably you do not agree. | ||||||||
| ||||||||