17 ms·
> 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
by 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.