Subscribe to our Erlang Factory newsletter to receive the latest updates and news

Gábor Fehér
Budapest University of Technology and Economics

Gábor Fehér is an MSc student at the Budapest University of Technology and Economics. His first and only Erlang experience is his (ongoing) masters project. His interests include algorithms, designing programming languages, functional & logic programming.

Gábor Fehér is Giving the Following Talks
ETC: An Object-Oriented Extension to Erlang

To structure the code of an Erlang program, one can split it into modules. There are also available some basic data structures: lists, records and tuples. However, there are no fully functional classes that encapsulate data and functionality, and can be extended with inheritance. We think these features could promote code reuse in certain cases, therefore we decided to extend the language with object-oriented capabilities. A strong evidence of the usability of
this is the fact that part of the program itself was rewritten using our newly created language elements, and the new version was simpler and cleaner than the original Erlang one.

Our main goals were to preserve the single-assignment nature of Erlang and to keep method-call and value-access times constant. It was also a priority to make the extension easily installable, to reach as much developers as possible. For this, we avoided changes in the Erlang compiler itself. Instead, we created the extension as a parse transformation. In our implementation a class is a module that contain the methods, and a record type whose instances are the
object instances. Both methods and fields can be inherited.

We also examined the currently available other object-oriented extensions for Erlang, and compared them with ours. Our imple-mentation has strong advantages, but it also lacks some features. Compatibility with records and speed are the main advantages. In this paper – among describing and comparing our extension – we also show the possible ways of adding the missing features.