type safety (was Re: FAQ terminology harmonisation)

Chris Pressey cpressey@REDACTED
Thu Apr 3 22:03:27 CEST 2003

On Thu, 3 Apr 2003 01:28:43 -0800 (PST)
Thomas Lindgren <thomasl_erlang@REDACTED> wrote:

> * The main benefit of Erlang, Lisp, Prolog, SML and so
> on is _type_safeness_: there is no way that you can
> accidentally confuse one value's type with another.

Not in Erlang.
Not if you consider tuples and records two different types.
Which they should be.
But aren't.
We won't have type safety until we have truly opaque types.
We have a warning not to let type information leak out of a module.
But we currently *have* to implement types on top of existing types:
usually tuples, or lists, or binaries could be used, or even refs or
pids or atoms... but all of these can be confused with others of the
same type, used in a different role.
If someone writes a case statement which matches on tuples or lists,
they could match on my custom type, quite by accident.
Because no matter how well I try to make it opaque, I can't.
I can only try to follow a format regime ("always tag tuples" etc)
But if other people don't follow the same regime, it's all for naught.
This regime *has* to be part of the language in order for Erlang to
honestly make the claim of type safety.


More information about the erlang-questions mailing list