[erlang-questions] Erlang Syntax and "Patterns" (Again)

Jesper Louis Andersen <>
Sat Mar 19 20:43:47 CET 2016

On Sat, Mar 19, 2016 at 5:34 PM, Emil Holmstrom <> wrote:

> I fail to see the significance of the type system in this case, it doesn't
> stop Erlang to have a char() type?

Right. You would have to invent a new tag for it, and you would have to
potentially take a performance hit due to the new tagging scheme, but
adding distinct values at runtime is fairly easy to do. With different
tags, $a and 97 are now different values, and conversion between them is
now explicit. What makes this idea more powerful in statically typed
languages has to do with erasure: once we have a compiled program with a
picked representation, we can choose the same representation for multiple
types. This is what makes it efficient: char and int are both implemented
as integers internally, but the type system protects against misusing one
as the other. Erlang terms must be self-describing.

With a more complex type zoo comes the additional burden of managing
differences among types however. This is not free for the programmer, and
most programming languages try to strike a balance between precision and
convenience. Of course, there are different opinions as to what level is

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20160319/7b93fd22/attachment.html>

More information about the erlang-questions mailing list