HNHacker News
TopNewBestAskShowJobs

scala_hacker

8 karma · joined August 10, 2010

submissionscomments
scala_hacker··on Beyond Scala 2.8 - A Roadmap
They place upper and lower bounds on the type member.
scala_hacker··on Beyond Scala 2.8 - A Roadmap
Consider the following program:

  trait X {
    trait A { type T >: Int <: Int }
      val x : A
      var n : x.T = 3
    }

  trait Y extends X {
    trait B { type T >: String <: String }
    lazy val x : A with B = x
    n = "foo"
  }

  new Y {}
I just used this because it is extremely simple and is just the tip of the iceberg. It is possible to exploit this in much more interesting ways and dangerous ways, but those are less concise.

It is worth noting that this is not just a simple compiler bug, but a deep flaw in the way type members and type composition interact.

scala_hacker··on Beyond Scala 2.8 - A Roadmap
It is interesting that he does not mention any plans to fix the several egregious type soundness holes in Scala's type system.