4 ms·
Extension methods rely on overloading, they don't use dynamic dispatch.
by sirwhinesalot 4y ago
Extension methods rely on overloading, they don't use dynamic dispatch.
- fiddlerwoaroof 4y agoYeah, but typically in these languages operators don’t really need dynamic dispatch. (Although, I agree this causes surprising results).
- sirwhinesalot 4y agoC# and friends dispatch operators through overloading on static types. Extension methods rely on the same mechanism. A dynamic language like Wren cannot use such a mechanism. The author already pointed out the options: the current OO-style dispatch, Python-style "if the operator is missing, try the reverse direction", or multimethods like Julia (which are quite complex and heavyweight).