Created
March 28, 2016 19:55
-
-
Save SethTisue/332af8d6ac48c57deb9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> import scala.language.reflectiveCalls | |
import scala.language.reflectiveCalls | |
scala> type Structural = { def foo: Int; def foo_=(x: Int): Unit } | |
defined type alias Structural | |
scala> object O { var foo = 5 } | |
defined object O | |
scala> (O: Any).asInstanceOf[Structural].foo = 10 | |
(O: Any).asInstanceOf[Structural].foo: Int = 10 | |
scala> O.foo | |
res0: Int = 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment