What does scala.mobile mean?

... and why is a package a misleading name (I assumed it was something related to JavaME or mobile / smart phones)?

I did not find any links on the Internet about scala.mobile.Code or scala.mobile.Location in general , and I could not do anything with these classes other than getting ClassCastExcetion or NoSuchMethodError s.

In fact, there is not even one test against scala.mobile in the Scala test tree, which could help to understand this code.

Classes really smell like they were forgotten in the source tree a long time ago and were accidentally released from that moment.

Maybe I just missed something?

Update: scala.mobile was removed in Scala 2.9.

+4
source share
2 answers

I just checked the source code.

When Scala changed the name of the class file a few years ago, and people seem to have forgotten to update these classes accordingly.

So, I would answer:

At the very least, Location has no purpose, because it is impossible to get anything reasonable from it (except for exceptions), and Code without Location very limited. It works, although if you pass the class literal directly to Code :

 import scala.mobile._ val c = new Code(classOf[scala.collection.mutable.StringBuilder]) c.apply[StringBuilder, String]("append")("Foo") c.apply[String]("toString")() // returns "Foo" c.apply[Int]("length")() // returns 3 

It looks like another implementation in the standard reflection library is a bit better.

+4
source

The Location description pretty much explains what this means:

The Location class provides a method for instantiating objects from a network location by specifying the URL of the jar / class file.

It can be used by remote members. May be.

And why does he have this misleading name? Well, back in 2004, smartphones had very low penetration, so perhaps the association was not so strong.

+3
source

All Articles