8 Oct 00:30
Scala interpreter: classpath vs. class loader
From: Michael <michid <at> gmail.com>
Subject: Scala interpreter: classpath vs. class loader
Newsgroups: gmane.comp.lang.scala
Date: 2008-10-07 22:30:42 GMT
Subject: Scala interpreter: classpath vs. class loader
Newsgroups: gmane.comp.lang.scala
Date: 2008-10-07 22:30:42 GMT
Currently the Scala interpreter/compiler needs a string classpath in order to resolve imports. However, this is a problem in an OSGi environment where such a classpath is not available but classes should rather be loaded from the class loader. I took a look at the Scala sources. As it seems, Scala currently rebuilds the directory structure of the classpath in memory. Using class loaders this is not possible since classes can only be loaded on the fly from a given class name. There is no way to enumerate the classes of a class loader. Is this pre-loading a strict requirement for the Scala compiler or can it cope with on the fly loading? That is, does the Scala compiler need to enumerate available classes? I figure that could be the case for resolving implicits and on demand imports. If this is the case, we might be out of options for OSGi environments - which is a petty. If not, what would be a good starting point to add support for loading classes from a class loader? Could it even be done in a compiler plugin? (I dont think so but I might be wrong). Any pointers appreciated. Michael
RSS Feed