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.

Contents<br />

1 Introduction 7<br />

1.1 Scope ................................ 7<br />

1.2 Background ............................ 8<br />

1.2.1 The Scala programming language ........... 8<br />

1.2.2 The Java virtual machine ................ 9<br />

1.2.3 The Scala compiler .................... 10<br />

1.3 Inheritance graph notation .................... 13<br />

2 Mixins 15<br />

2.1 Introduction ............................ 15<br />

2.1.1 Single inheritance ..................... 15<br />

2.1.2 Multiple inheritance ................... 15<br />

2.1.3 Mixin inheritance ..................... 16<br />

2.1.4 Trait inheritance ...................... 16<br />

2.2 Mixin inheritance in Scala .................... 17<br />

2.2.1 Mixin example ...................... 18<br />

2.3 Encoding mixins on the JVM .................. 19<br />

2.3.1 Typing aspect ....................... 20<br />

2.3.2 Code sharing aspect ................... 20<br />

2.3.3 Encoding used by scalac ................ 22<br />

2.4 Interfaces for types ........................ 25<br />

2.4.1 The AddInterfaces phase ................ 25<br />

2.4.2 Unmixable classes .................... 26<br />

2.4.3 Subclasses of Java classes ................ 27<br />

2.4.4 Private members ..................... 28<br />

2.5 Inlining mixin code ........................ 29<br />

2.5.1 The ExpandMixins phase ................ 29<br />

2.5.2 Mixin type parameters .................. 30<br />

2.5.3 Mixin constructors .................... 30<br />

2.5.4 Private members ..................... 31<br />

2.5.5 Overridden members .................. 31

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

Saved successfully!

Ooh no, something went wrong!