Opaque Data Types in Erlang


By Erlang Central | Published: November 12, 2009



Many languages provide mechanisms for programmers to declare abstract data types (ADTs), hide the details of their implementation, and allow manipulation of these ADTs only by controlled interfaces. This information hiding strategy allows the implementation of the ADT module to be changed without disturbing the client programs.  In Erlang programs structural information about ADTs is exposed by pattern matching and type inspecting built-ins, making it very hard to guarantee that changes in the ADT’s implementation will not have devastating effects on client’s code.  We have recently extended Erlang with the ability to declare opaque terms (i.e., terms whose structure should not be inspected outside their defining module) and detect violations of their opaqueness using Dialyzer. In this talk we will present this addition to the language and its capabilities, and will show interesting examples of code that (erroneously) depended on implementation details of commonly used library modules (ETS tables, gb_sets, gb_trees, etc.).

Speakers:

  • Kostis Sagonas

    HiPE compiler writer and tool developer
    National Technical University of Athens, Greece

    Kostis Sagonas is an academic who has been involved in the development of the Erlang language and its implementation since 1999. At Uppsala University, he has led the development team of the HiPE native code compiler. Together with his students he has contributed directly to various changes and additions to the Erlang language (e.g., bit-level pattern matching and bit-stream comprehensions, type and spec declarations, etc.) its libraries and runtime system support for concurrency. A hacker at heart, he has created widely used software development tools for Erlang, like dialyzer which by now has located literally thousands of bugs and software defects in Erlang programs. At NTUA in Athens, he has turned his obsession for clean designs and programs into yet another slick software tool for Erlang, called tidier, whose details are going to be unveiled for the first time at the Erlang Factory.

    • Kostis' old homepage at Uppsala University, Sweden
    • Kostis' newer homepage (with Greek letters!) at the
         National Technical University of Athens, Greece

    Kostis Sagonas


Follow Erlang Central:


Have an Erlang Question?

Reach out to the Erlang community





Tags