News for hackers. Stuff that matters.
Re:Inheritance Is Terrible by yummyfajitas on Saturday March 19, 2016 @04:42PM (#11320352)
I don't understand his comment, "I'm disappointed to see that Scala has largely preserved Java's inheritance model." This directly translates to scala:

    trait Priceable {
      def price: Int
    }

    def addToCart(cart: Cart, item: Priceable) {
      cart.increaseTotal(item.price)
    }

    class Book extends Priceable {
       ...same thing...
    }
The only thing non-idiomatic about this in Scala is the use of a mutable cart.
Re:Inheritance Is Terrible by lbarrow on Saturday March 19, 2016 @04:44PM (#11320359)
Traits are great, but Scala still has subclassing. I'll update the article to make it more clear -- thanks for pointing that out.
Re:Inheritance Is Terrible by jpitz on Saturday March 19, 2016 @05:00PM (#11320430)
Subclassing isn't evil. Subclassing which violates Liskov Substitution, now I'm listening.
Re:Inheritance Is Terrible by noobermin on Saturday March 19, 2016 @05:09PM (#11320457)
>but Scala still has subclassing

C++ has goto and labels, and although they are not needed for the most part in modern C++, they are still there. The key here is the programmer does not need to use them.