News for hackers. Stuff that matters.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by colllectorof on Saturday October 19, 2019 @01:30PM (#21299606)
Functional programmers will reply that you can use partial evaluation and higher-order functions to do that.

The sad reality is that since so many people are only familiar with the strawman version of OOP rather than the real thing intelligently discussing the advantages and disadvantages of these paradigms is very hard.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by hota_mazi on Saturday October 19, 2019 @01:38PM (#21299656)
Yes, I've heard them say that indeed. They often gloss over a lot of issues about these.

For example, partial evaluation is limited by the fact that parameters need to be ordered a certain way and you can't realistically cover all combinations.

Higher order functions don't enable any kind of useful specialization at all. And of course, all modern OOP languages also support higher order functions, so they are the ones giving you more tools.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by nitrogen on Saturday October 19, 2019 @02:55PM (#21300071)
Do any functional languages support partial evaluation using named parameters? That would solve the parameter ordering complaint.

As for higher order functions you would write a function that does the 90% and accepts a function parameter for the other 10%.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by catalogia on Saturday October 19, 2019 @03:38PM (#21300303)
Racket's curry supports keyword arguments.

https://docs.racket-lang.org/reference/procedures.html#%28de... (god links into the racket docs are ugly...)

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by hota_mazi on Saturday October 19, 2019 @03:59PM (#21300444)
> As for higher order functions you would write a function that does the 90% and accepts a function parameter for the other 10%.

Surely you see how this doesn't scale, right?

You would need to first write your code, then abstract every single piece of it as a call to a function passed in parameters. Now your function is accepting five different functions in parameters, and calls them.

This is a terrible and impossible to scale way to emulate class specialization.

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by tome on Sunday October 20, 2019 @05:39AM (#21303133)
So put those parameters in a single record type and just override the 10% of them that you need to.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by kragen on Sunday October 20, 2019 @12:19PM (#21305066)
Abadi and Cardelli identified some ways that this solution falls short—in particular, the self parameter isn't covariant—and how to fix them.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by kragen on Saturday October 19, 2019 @03:03PM (#21300112)
OCaml has named (“labeled”) parameters, and of course you can use combinators like flip to bind positional parameters like the second or third. I'm not sure what the relevance to inheritance is, though, and “partial evaluation” usually means an optimization strategy rather than just currying.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by tome on Saturday October 19, 2019 @02:34PM (#21299972)
Could you give some concrete examples? At the moment it's just assertions.