Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package foo
- import scala.language.dynamics
- object Caller extends App {
- val client = new Client() // initialise an R interpreter
- client.x = 1.0
- }
- class Client extends Dynamic {
- var map = Map.empty[String, Any]
- def selectDynamic(name: String) = map get name getOrElse sys.error("field not found")
- def updateDynamic(name: String)(value: Any) { map += name -> value }
- }
- scalaVersion := "2.10.6"
- libraryDependencies++= Seq(
- "org.scalanlp" %% "breeze" % "0.12"
- )
- [error] /home/philwalk/dynsbt/src/main/scala/foo/Caller.scala:8: type mismatch;
- [error] found : foo.Caller.client.type (with underlying type foo.Client)
- [error] required: ?{def x: ?}
- [error] Note that implicit conversions are not applicable because they are ambiguous:
- [error] both method any2Ensuring in object Predef of type [A](x: A)Ensuring[A]
- [error] and method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A]
- [error] are possible conversion functions from foo.Caller.client.type to ?{def x: ?}
- [error] client.x = Seq("a","b","c")
- [error] ^
- [error] one error found
- [error] (compile:compileIncremental) Compilation failed
- [error] Total time: 3 s, completed May 3, 2016 11:03:08 AM
- client.x = 1.0
- client.xx = 1.0
Add Comment
Please, Sign In to add comment