- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
serializing the type environment for IDE exploration
Mon, 2010-03-29, 09:11
I have a question related to one of my write-ups ("Decoding external types
on JVM and CLR" [1]). Although the original motivation is Scala.Net-based,
the mechanism I'm looking for would also be of use under JVM.
As you may have noticed I came up with an idea
http://permalink.gmane.org/gmane.comp.lang.scala.tools/4322
to explore how Scala would represent (at the source code level) the type
information of a .NET assembly. I might develop a quick prototype to test
the idea.
However, the prototype would be redundant in case there were a mechanism
(patch?) to have nsc print out after the typing phase, not the compilation
units, but the contents of the assemblies given by -Xassem-extdirs (printing
them out as type definitions with empty method bodies, save for a dummy
return of the type's default value)
The above "experiment" amounts to serializing into .scala files the type
environment, which could be useful in itself. Anyone been there before?
Miguel
[1]
http://www.sts.tu-harburg.de/people/mi.garcia/ScalaCompilerCorner/TypeDe...
iulian
class SymbolPrinter(out: PrintWriter) extends treePrinters.Printer(out) { def printClass(sym: Symbol) { print(sym.toString) if (!sym.info.typeParams.isEmpty) printRow[Symbol](sym.info.typeParams, printTypeParam, "[", ", ", "]") print(" extends ") printRow[Type](sym.info.parents, (t => print(t.toString)), "", " with ", "") printColumn(sym.info.decls.toList, printMember, "{", "", "}\n") flush } def printTypeParam(sym: Symbol) { print(sym.name); print(sym.info.bounds.toString) } def printMember(sym: Symbol) { if (sym.isClass) printClass(sym) else print(sym.defString) } }
On Mon, Mar 29, 2010 at 10:10 AM, Miguel Garcia <miguel.garcia@tuhh.de> wrote:
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais