3 ms·
Except we were never talking about JavaScript. I thought the OP made it pretty clear that they only cared about the syntax of method calls because they flow nic
by wtetzner 3y ago
Except we were never talking about JavaScript. I thought the OP made it pretty clear that they only cared about the syntax of method calls because they flow nicely and more easily support auto-complete in editors. Simple syntax sugar that translates `foo.bar(x, y)` into `bar(foo, x, y)` would suffice for both.
- galaxyLogic 3y ago> Syntax sugar that translates `foo.bar(x, y)` into `bar(foo, x, y)` For that to be syntactic sugar it would have to be the case that foo.bar(x, y) and bar(foo, x, y) always produce the same result for any given values of 'foo', 'x' and 'y'. Is there a language where that is the case?
- wtetzner 3y agoThere doesn't need to be a language where that's the case for it to be desirable in Odin. However, yes, there are languages where that's the case: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax I would also argue that extension methods in languages like C# and Kotlin are just sugar.