Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 17 lines (11 sloc) 0.367 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Type in expressions to have them evaluated.
Type :help for more information.

scala>

scala> import scala.language.dynamics
import scala.language.dynamics

scala> class Dyn(m: Map[String, Any]) extends Dynamic { def selectDynamic[T](s: String): T = m(s).asInstanceOf[T] }
defined class Dyn

scala> new Dyn(Map("foo" -> 10)).foo[Int]
res0: Int = 10

scala>

scala>
Something went wrong with that request. Please try again.