Live data from Hacker News

Inheritance was invented as a performance hack (2021)

catern.com

251–252 of 252 posts

Re: Inheritance was invented as a performance hack (2021)

#251
post #88

Earlier quoted context omitted.

And Rust's traits can sort-of inherit from each other.

I'm fine with trait inheritance. (If you want to call it that - its maybe better to describe it as trait preconditions.) I'm fine with it because trait inheritance doesn't increase code complexity in the same way C++ / Java class inheritance does. If you call foo.bar(), its usually pretty obvious which function is being called. And you only ever have to look in one place to see all the fields of a struct. In C++, its…

> In C++, its common to have a class method say "blah = 5;" or something. Then you need to spend 5 minutes figuring out where "blah" is even defined in the class hierarchy.

Some of this can be remedied with tooling. A nice "show usages" would solve this. Also, some IDEs have a class browser, where you can see the inheritance tree with all the members.

Re: Inheritance was invented as a performance hack (2021)

#252
post #243
post #241

Earlier quoted context omitted.

Don't have manifest types and don't have manifest interfaces. Someone has already referenced "Adding Dynamic Interfaces to Smalltalk" [0] and looking back there doesn't seem to be any kind of demonstration that use of interfaces makes software faster to develop or less error prone or... [1] [0] https://www.jot.fm/issues/issue_2002_05/article1/ [1] https://www.cs.utexas.edu/~wcook/papers/OOPSLA89/interfaces.pdf

Unfortunately, in general, there is not much convincing proof that one way of developing software is better than another in such ways.

And even if there were:

    "We are not finders of fact. We are tellers of story.

       You base the story on the evidence, no?

   No! We base the evidence on the story. We prove what helps us, and we disprove what hurts us. Whoever tells the best story goes home with the cash-in prizes."

   (The Good Fight, season 3 episode 2. 30 - 31 minutes. CBS All Access 2019.)
Post reply on HN