3 ms·
> I don't know why you have operator overloading at all. Wren doesn't have "operator overloading". There is no separate feature in addition to the normal opera
by munificent 4y ago
> I don't know why you have operator overloading at all.
Wren doesn't have "operator overloading". There is no separate feature in addition to the normal operator support that also lets you overload them. Wren just uses single dispatch for infix operators. Even the "built in" operator behavior like addition on numbers is simply pre-defined methods on the Number class. Like Smalltalk (which Wren is heavily inspired by), everything is just a method call and there is little "special" behavior for primitives.
- deleted 4y ago[deleted]
- randomswede 4y agoSo if I understand this correctly, "a + b" is syntactic sugar for "a.+(b)" (modulo the exact name of the method)?
- munificent 4y agoYes, exactly. Basically everything is method calls.