Change other languages behaviour from own Truffle language

Lars Schuetze lars.schuetze at
Fri Apr 20 06:22:29 UTC 2018


since there is no special Truffle mailing list I ask my question here. I am a longtime listener to that mailing list and also used Graal in research with students.

We currently do research on role-oriented programming languages. Role-orientation is an enhancement of object-orientation such that objects can play roles. By doing so, their type and behaviour (ie., method dispatch) is changed. For example, first a.m() dispatches to method m implemented in class A. But after playing the role r, a.m() will be dispatched to method f in R.
Also, there exist operators like in aspect-orientation that can change instances of classes in a crosscutting manner.
Roles themselves define methods etc. just like normal classes. However, they cannot exist on their own. They always have to be played by objects.

Currently, there exist some implementations for these languages. For example, SCROLL (Scala Roles Language) [1] is implemented in Scala using the Dynamic trait and a handwritten dispatch implementation in userland to cope with the different memory model of roles.
Eclipse ObjectTeams on the other hand is implemented in Java as an extension of JDT and also employs a load time compiler built with the ASM library. It is able to adapt existing and compiled applications with roles. It also has a handwritten runtime in userland.

My question would be if by using Truffle we would be able to implement such a behaviour that when calling a method a.m() in language A it will be dispatched to a method r.f() in our language? I see that we could use Truffle to implement a language that can have that behaviour in its own but I don’t see if it is possible to change the behaviour of other languages from ours.

Thank you for your insights. If there are any questions just ask me. I can also elaborate on topics if needed.

Lars Schütze

PS: Congratulations for the 1.0 release of Graal.


- -
M.Sc. Lars Schütze
Research Assistant

Chair for Compiler Construction
Technische Universität Dresden
cfaed – Center for Advancing Electronics Dresden
01062 Dresden

Phone: +49 351 463-43733
Fax: +49 351 463-399-95
Mail: lars.schuetze at

More information about the graal-dev mailing list