Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
protomolecule
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
62 ms
·
691.
▲
by
protomolecule
7y ago
"I'm not arguing that open recursion is part of OOP definition" Should be: is not a part
692.
▲
by
protomolecule
7y ago
I think there is a difference between having a way to bypass encapsulation and deliberately not having encapsulation at all. Otherwise I agree with you.
693.
▲
by
protomolecule
7y ago
Yes, that sentence was wrong and if you say that ability to override any method is the essence of the true OOP I would agree that the true OOP is a disaster.
694.
▲
by
protomolecule
7y ago
But what I described IS an abstract data type and the concept of abstract data types appeared in CLU which is an OO language. What's more, encapsulation (data-hiding) don't seem to be an integral part of FP and Haskell's modu
695.
▲
by
protomolecule
7y ago
`factorial` definition hasn't changed, what changed is its implicit parameter. The word 'inherit' tells you that all methods of the `computer` class are potentially affected, including `factorial` unless you can see in `pred`
696.
▲
by
protomolecule
7y ago
"Yeah, no, you are redefining factorial in terms of different `pred` functions, and I'm simply defining `prev` without redefining factorial." No, you are not simply defining `prev`, you are creating a new class using `compute
697.
▲
by
protomolecule
7y ago
"No, open recursion is the only thing that makes OOP a distinct paradigm. Without `self` you don't have OOP." I'm not arguing that open recursion is part of OOP definition, I just disagree that C++ and C# aren't OOP
698.
▲
by
protomolecule
7y ago
I haven't thought of Java. As the sibling comment says, it's the case for C++ and C#. In case of Java I agree with ernst_klim's critique, to me it's a poor language design choice. Dynamic languages are a mess anyway, but
699.
▲
by
protomolecule
7y ago
"Non virtual methods has nothing to do with OOP, they are a mere sugar for function calling." By this logic virtual functions are mere sugar for tables of functions and as such have nothing to do with anything besides functions an
700.
▲
by
protomolecule
7y ago
"In your example you are explicitly breaking factorial. In my example I'm just defining `pred`, and it's unexpectedly and implicitly breaking factorial." In all mainstream languages with OOP features methods by default a
701.
▲
by
protomolecule
7y ago
A simple example on how higher order functions are harmful. Consider we have a function which computes the factorial: let rec fact(x, prev) = if x <= 1 then 1 else x * fact(prev(x), prev);; let factorial(x) = fact(x, fun x -> x-