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.
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.