Guest User

Untitled

a guest
May 3rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. package foo
  2.  
  3. import scala.language.dynamics
  4.  
  5. object Caller extends App {
  6. val client = new Client() // initialise an R interpreter
  7. client.x = 1.0
  8. }
  9. class Client extends Dynamic {
  10. var map = Map.empty[String, Any]
  11. def selectDynamic(name: String) = map get name getOrElse sys.error("field not found")
  12. def updateDynamic(name: String)(value: Any) { map += name -> value }
  13. }
  14.  
  15. scalaVersion := "2.10.6"
  16.  
  17. libraryDependencies++= Seq(
  18. "org.scalanlp" %% "breeze" % "0.12"
  19. )
  20.  
  21. [error] /home/philwalk/dynsbt/src/main/scala/foo/Caller.scala:8: type mismatch;
  22. [error] found : foo.Caller.client.type (with underlying type foo.Client)
  23. [error] required: ?{def x: ?}
  24. [error] Note that implicit conversions are not applicable because they are ambiguous:
  25. [error] both method any2Ensuring in object Predef of type [A](x: A)Ensuring[A]
  26. [error] and method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A]
  27. [error] are possible conversion functions from foo.Caller.client.type to ?{def x: ?}
  28. [error] client.x = Seq("a","b","c")
  29. [error] ^
  30. [error] one error found
  31. [error] (compile:compileIncremental) Compilation failed
  32. [error] Total time: 3 s, completed May 3, 2016 11:03:08 AM
  33.  
  34. client.x = 1.0
  35.  
  36. client.xx = 1.0
Add Comment
Please, Sign In to add comment