3 ms·
1. We're not talking about a method that mutates state because this method doesn't mutate state. We can add a `mutating` keyword to the method (this is in fact
by RivieraKid 4y ago
1. We're not talking about a method that mutates state because this method doesn't mutate state. We can add a `mutating` keyword to the method (this is in fact implemented for Swift structs, but not classes).
2. I don't get this. What's the difference from Julia? Whether the operation is commutative is defined by the implementation of +, like in Julia, AFAIK.
3. Multiple dispatch seems useful in these cases, although it's a fairly niche area. I don't know how doable would this be just with generic programming / protocols without MD, didn't think too much about it. I vaguely remember that I didn't like that extending code with MD in a way relies on implicit, undefined interfaces.