2 ms·
Receivers are utterly idiotic. Like how could anyone with two working brain cells sign off on something like that? If you don't want OOP in the language, but w
by kazinator 2y ago
Receivers are utterly idiotic. Like how could anyone with two working brain cells sign off on something like that?
If you don't want OOP in the language, but want people to be able to write thing.function(arg), you just make function(thing, arg) and thing.function(arg) equivalent syntax.
- db48x 2y agoI completely agree with that.
- Pxtl 2y agoC# did this for extension methods and it Just Works. You just add the "this" keyword to a function in a pure-static class and you get method-like calling on the first param of that function.
- kazinator 2y agoIf the function has to be modified in any way in order to grant permission to be used that way, then it is not quite "did this". Equivalent means that there is no difference at the AST level between o.f(a) and f(o, a), like there is no difference in C among (a + i), a[i], i[a] and (i + a). However, a this keyword is way better than making the programmers fraction off a parameter and move it to the other side of the function name.
- tczMUFlmoNk 2y agoA search term here is "Uniform Function Call Syntax", as present in (e.g.) D: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax