News for hackers. Stuff that matters.
Re:Greppability is an underrated code metric by kazinator on Tuesday September 03, 2024 @11:02AM (#41435636)
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.

Re:Greppability is an underrated code metric by Pxtl on Tuesday September 03, 2024 @11:31AM (#41435941)
C# 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.
Re:Greppability is an underrated code metric by kazinator on Tuesday September 03, 2024 @11:37AM (#41436004)
If 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.

Re:Greppability is an underrated code metric by tczMUFlmoNk on Tuesday September 03, 2024 @01:45PM (#41437256)
A search term here is "Uniform Function Call Syntax", as present in (e.g.) D:

https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax

Re:Greppability is an underrated code metric by db48x on Wednesday September 11, 2024 @01:57AM (#41508416)
I completely agree with that.