This page is no longer maintained — Please continue to the home page at www.scala-lang.org

scala.Dynamic assignment/apply

No replies
Vladimir Kirichenko
Joined: 2009-02-19,
User offline. Last seen 42 years 45 weeks ago.

Hi, all

scala> class X extends scala.Dynamic {
| def applyDynamic(name: String)(args: Any*) = println("invoked:"
+ name + ":" + args)
| }

scala> res0.y = 3
dynatype: $line2.$read.$iw.$iw.res0.applyDynamic("y")()
:9: error: reassignment to val
res0.y = 3

scala> res0(3)
:10: error: X does not take parameters
res0(3)

Is this going to be supported?

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland