ECT: an object-oriented extension to Erlang

  • Authors:
  • Gábor Fehér;András G. Békés

  • Affiliations:
  • Budapest University of Technology and Economics, Budapest, Hungary;Ericsson Hungary, Budapest, Hungary

  • Venue:
  • Proceedings of the 8th ACM SIGPLAN workshop on ERLANG
  • Year:
  • 2009

Quantified Score

Hi-index 0.01

Visualization

Abstract

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 transformation1 . 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 implementation 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.