02.07.2013 Views

COMPILING SCALA FOR THE JAVA VIRTUAL MACHINE - EPFL

COMPILING SCALA FOR THE JAVA VIRTUAL MACHINE - EPFL

COMPILING SCALA FOR THE JAVA VIRTUAL MACHINE - EPFL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Abstract<br />

Scala is a new programming language developed at <strong>EPFL</strong> and incorporating<br />

the most important concepts of object-oriented and functional languages.<br />

It aims at integrating well with the Java and .NET platforms: their<br />

respective libraries are accessible without glue code, and the compiler can<br />

produce programs for both virtual machines.<br />

This thesis focuses on the compilation of two important concepts of<br />

Scala : mixin inheritance and run time types. The compilation techniques are<br />

presented in the context of the Java virtual machine, but could be adapted<br />

easily to other similar environments.<br />

Mixin inheritance is a relatively recent form of inheritance, offering<br />

new capabilities compared to single inheritance, without the complexity<br />

of multiple inheritance. We propose two implementation techniques<br />

for mixin inheritance: code copying and delegation. The implementation<br />

used in the Scala compiler is then presented and justified.<br />

Run time types make it possible for a program to examine the type of<br />

its values during execution. This possibility is interesting in itself, offering<br />

new capabilities to the programmer. Furthermore, run time types are<br />

also required to implement other high level concepts, like pattern matching,<br />

type-safe serialisation and reflection. We propose an implementation<br />

technique based on the representation of types as values, and show how<br />

to use the run time types of the underlying virtual machine to implement<br />

those of Scala.<br />

The techniques presented in this thesis have been implemented in our<br />

Scala compiler, scalac. This enabled us to evaluate these techniques, in<br />

particular their impact on the performances of programs. This evaluation<br />

was performed on several real, non-trivial programs.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!