4 ms·
> 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'
by hota_mazi 7y ago
> 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.
- ErotemeObelus 7y ago> Surely you see how this doesn't scale, right?... This is a terrible and impossible to scale way to emulate class specialization. <Kelsey Grammar Voice> Heretic! Have not the elders of our holy church indeed canonized the ex cathedra dogmas of variable immutability and higher-order functions with closed variables? And indeed have we not been in ecumenical agreement over the incomprehensible mystery of the trinity of higher order types, dependent types, and polymorphic types? Dare ye teach heresy proudly with thy contumely? Anathema sit!
- tome 7y agoSo put those parameters in a single record type and just override the 10% of them that you need to.
- kragen 7y agoAbadi and Cardelli identified some ways that this solution falls short—in particular, the self parameter isn't covariant—and how to fix them.