• wewbull@feddit.uk
      link
      fedilink
      English
      arrow-up
      1
      ·
      10 hours ago

      Do you include “traits” and “interfaces” under the title “inheritance”?

    • Supercrunchy@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 day ago

      It might be nice to use in some very specific cases (e.g. addition-operation is a binary-operation AST node which is an AST node).

      In most of the cases it just creates noise though, and you can usually do something different anyway to implement the same feature. For example in rust, just use enums and list all the possible cases and it’s even nicer to use than inheritance.

      • tatterdemalion@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 hours ago

        Some legacy Python code that already used inheritance. I had to extend it, and it was pretty infeasible to refactor the whole thing to not use inheritance. Not sure if I technically regretted that decision, but it was definitely painful, since Python inheritance makes it really hard to follow program control flow.