Skip to content

Instantly share code, notes, and snippets.

@asflierl
Created January 30, 2013 19:44
Show Gist options
  • Save asflierl/4676164 to your computer and use it in GitHub Desktop.
Save asflierl/4676164 to your computer and use it in GitHub Desktop.
Dependent method types in Scala 2.10.... ooooOOOO yeah!
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_11).
Type in expressions to have them evaluated.
Type :help for more information.
scala> trait Meep { type Moop; def f: Moop }
defined trait Meep
scala> def fnord(a: Meep): a.Moop = a.f
fnord: (a: Meep)a.Moop
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_11).
Type in expressions to have them evaluated.
Type :help for more information.
scala> trait Meep { type Moop; def f: Moop }
defined trait Meep
scala> def fnord(a: Meep): a.Moop = a.f
<console>:40: error: illegal dependent method type
def fnord(a: Meep): a.Moop = a.f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment