Live data from Hacker News

Liskov Substitution: The real meaning of inheritance

cekrem.github.io

91–92 of 92 posts

Re: Liskov Substitution: The real meaning of inheritance

#91

Earlier quoted context omitted.

> Your second line is a silly slogan which presumably means constraints make the job of picking one choice from a set easier due to less thought needed That is absolutely not what it means, and it is not a silly slogan — it is a basic law of reality. As an example, if your build system is monadic (build nodes can add new nodes dynamically) then the number of nodes in it is not known upfront. If the build system is no…

Again, these are all your preferences/opinions which you are stating as some sort of acknowledged truth; which is most definitely not the case. While there are many good points about Rust it is quite over-hyped with evangelical zeal which is why a lot of software engineers are turned off of it. Graydon Hoare himself has said he took the good ideas from old languages and put them together. That in itself is obviously…

I don't think there really is any reasonable way to disagree with "constraints liberate, liberties constrain", sorry. Anyone who has spent any amount of time with algebraic structures in mathematics will grasp this intuitively, as will anyone who has written code in a type-safe style. It really is a basic law of nature, similar to other basic principles like Bayes' law.

I only brought in Rust because it does polymorphism in a non-OO style.

Re: Liskov Substitution: The real meaning of inheritance

#92

Earlier quoted context omitted.

Again, these are all your preferences/opinions which you are stating as some sort of acknowledged truth; which is most definitely not the case. While there are many good points about Rust it is quite over-hyped with evangelical zeal which is why a lot of software engineers are turned off of it. Graydon Hoare himself has said he took the good ideas from old languages and put them together. That in itself is obviously…

I don't think there really is any reasonable way to disagree with "constraints liberate, liberties constrain", sorry. Anyone who has spent any amount of time with algebraic structures in mathematics will grasp this intuitively, as will anyone who has written code in a type-safe style. It really is a basic law of nature, similar to other basic principles like Bayes' law. I only brought in Rust because it does polymorp…

Pointing to Algebraic structures is not an argument since it is fundamental to mathematics and hence to programming in any language. What do you think a Type/ADT is? Why do you think user-defined types exist in any language? It is a given, the only difference is the strict pov taken by functional languages vs. imperative (procedural/OO) languages. There is a reason i pointed to the example of linking the derived type's contracts (i.e. properties) with the base type's because that would have made the isomorphism between two algebraic structures clearer (which you didn't seem to understand). Repeating some slogan is not knowledge. You have to go beyond the immediate notation/syntax in any language to the abstract concept it is trying to express. That is the heart of mathematics and programming.

Since you brought up algebraic structures, C++ can express it directly using template syntax and relationships between them using parametric polymorphism non-OO style. Not only that, but because in C++ genericity is unconstrained, we actually can use OO inheritance for a type hierarchy and then using it to get constrained genericity. This flexibility is quite powerful and you get full type checking.

To understand all this (and apply the concepts in any other language) see the books by Alexander Stepanov viz. From Mathematics to Generic Programming and Elements of Programming.

Post reply on HN