type safety (was Re: FAQ terminology harmonisation)
Thu Apr 3 22:11:37 CEST 2003
On Thu, Apr 03, 2003 at 02:03:27PM -0600, Chris Pressey wrote:
> 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.
I must say this whole discussion has been rather educational and quite
exciting for me. I just hope people on the list don't hold it against me for
lighting the fuse on this one :-)
More information about the erlang-questions