News for hackers. Stuff that matters.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by pphysch on Friday June 24, 2022 @01:38PM (#31866350)
Bound methods simply has the potential to be a tiny bit more readable:

`thing.doWork(arg)`

`doWork(thing, arg)`

`doThingWork(thing, arg)`

The first example is marginally more readable IMO. The second one sucks from a human perspective because we don't immediately know (unlike the IDE) that the function signature only accepts Things. The last one addresses this but is even longer, and we still have to mentally unpack the args.

IMO there is not much profound about OOP, but it can lead to slightly more readable code if used appropriately.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by blinzy on Friday June 24, 2022 @04:24PM (#31868828)
Is your first/native language SVO (subject-verb-object)? Mine isn't, it's VSO (verb-subject-object) or SOV (subject-object-verb), and for me the first example isn't more readable so I wonder if that also changes our perspective on what option we see as the most natural.

I can admit though that from an IDE point of view having auto-completion upon writing thing and typing the dot and seeing the results is very useful, whereas there is nothing (as far as I know) that comes even close in functional languages where the second example is more typical.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by random314 on Friday June 24, 2022 @02:15PM (#31866964)
I kinda agree. But my personal take is different.

Functions can be invoked in at least 3 different ways or a mixture of the three

1. Prefix - C style f(x,y,z)

2. Infix - x + y; x.f(y,z); a join b

3. Post fix- (x,y,z) $ f

Infix is the best style in most cases, OOP accidentally helped programmers use a more readable infix style.

A lot of the benefits of OOP can be had by allowing good infix invocation support and interface support in an imperative non OOP language. Might as well throw in generics.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by pphysch on Friday June 24, 2022 @02:52PM (#31867622)
Yes, you put it better.

Infix is tricky because it doesn't scale well to complex expressions. I think Python does it right with plenty of infix keywords a la "if thing not in myset: ...".

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by randyrand on Friday June 24, 2022 @07:23PM (#31870771)
I agree with you about that.

Long function invocations are an annoying consequence.