Scaletta Home Page

Abstract

We study the interplay between inner classes and virtual types. The combination of these two concepts can be observed in object-oriented languages like BETA or Scala. This study is based on a calculus of classes and objects composed of a very limited number of constructs. For example the calculus has neither methods nor class constructors. Instead it has a more general concept of abstract inheritance which lets a class extend an arbitrary object. Thanks to an interpretation of terms as types the calculus also unifies type fields and term fields. The main contribution of this work is to show that typing virtual types in the presence of inner classes requires some kind of alias analysis and to formalize this mechanism with a simple calculus.

Paper

Inner Classes and Virtual Types. Philippe Altherr, Vincent Cremet. Submitted to The European Conference on Object-Oriented Programming (Ecoop 2005). Last modified the 25th of December (2005).

Examples

integers.scala
Inductive integers with predecessor, successor and addition.
desugarizedIntegers.scala
Same example without syntactic sugar.
constructors.scala
Encoding of class constructors for two and three-dimensionnal points.
interfaces.scala
Encoding of interfaces (works also for mixins).
lists.scala
Encoding of generic lists with length and concatenation.
dependentFunctionTypes.scala
Types of functions over integers parameterized by the number of arguments.
primes.scala
Computation of prime numbers.
All the files are correctly type-checked by the compiler. They all contain a top-level test function main that can be called in the interpreter.

Compiler

scaletta-20041019.tar.gz
Archive containing an executable version of our compiler. It comes with a README explaining its usage and syntax.

Last modified the 27th of December (2005).