News for hackers. Stuff that matters.
Re:Another Scala rant on HN by lmm on Tuesday December 03, 2013 @05:08AM (#6839478)
I'd remove structural types. I don't see them being actually used in scala libraries, and I think "traditional" types provide a better replacement for most (all?) use cases.
Re:Another Scala rant on HN by octo_t on Tuesday December 03, 2013 @05:43AM (#6839574)
So as i understand it the 'use case' is for coercing 3rd party types into your own type hierarchy. Suppose you had:

  trait Foo {
    def bar(): Int
  }
and 3rd party library had

  final class FooBar extends java.lang.Object {
    public int bar() { /** **/ }
  }
you could simply define your methods to take in a:

  type BarAble = { def bar():Int }

But obviously if the library class is not final, you can simply do:

  type ThirdPartyFoo = FooBar with Foo
  ThirdPartyFoo <: Foo
Re:Another Scala rant on HN by trailfox on Tuesday December 03, 2013 @06:10AM (#6839626)
Removing structural typing wouldn't be an improvement to my mind. It's the sort of thing you use maybe once a year, but when you do it's extremely useful to have around. It's a bit like saying that removing the ternary conditional operator in Java would make a big difference to developers' lives.
Re:Another Scala rant on HN by lmm on Tuesday December 03, 2013 @06:14AM (#6839641)
I think the kind of features you use maybe once a year are a bad thing to have in programming languages - ease of reading is more important than ease of writing.
Re:Another Scala rant on HN by trailfox on Tuesday December 03, 2013 @06:20AM (#6839657)
I should also point out that it's a feature which I don't believe detracts from readability. It's pretty clear from looking at code which uses ST what it does. There are examples in this thread.

It's a feature that you will use directly maybe once a year when adding it to a library, but I then use that library (and indirectly that feature) virtually every day. YMMV but we've found it very useful.

Re:Another Scala rant on HN by octo_t on Tuesday December 03, 2013 @05:35AM (#6839544)
Ding ding!

(That's the answer I'd give if someone asked me this question)