Proposed change to libraries

Bjorn Gustavsson bjorn@REDACTED
Tue Feb 15 09:20:34 CET 2005

I agree.

We have no intention to change Erlang into another language
where you would have to declare your types. If your test suites
are complete enough to catch all of your bugs, you don't have to
use any other tools such as type checkers, cross-reference tools,
or compiler warnings.

My personal opinion is, however, that you can't have too many sharp
tools to help you find bugs. We have extensive test suites for OTP.
Still, we found bugs when we turned on warnings for unused variables.
The new warnings in R10B also pointed out several bugs. Dialyzer has
also pointed out several bugs, some of which would have been hard to
find with a test suite.


Kostis Sagonas <kostis@REDACTED> writes:

> Dominic Williams wrote:
>  > Erlang is not a type-safe language, so it seems to me that the
>  > libraries are consistent with the documentation if they work as
>  > advertized, for advertized types. There is no implicit suggestion
>  > that they should refuse to work on other types.
> Oh, but more often than not they do!  Try:
> 	lists:map(gazonk, [1]).
> and you will get an exception.
>  > I see guards as a pattern matching tool (i.e. to provide a separate
>  > clause for separate types), not as a type checking tool. I practice
>  > test-driven development, so I am not interested in the compiler
>  > doing any type checking. What matters to me, as a programmer, is that 
>  > Erlang allows me to write simple, economical code where I don't need
>  > to explicitly declare types or guarantee type safety.
> Let me assure you that whatever we do would not force you to change
> your favourite working habbits.  Nobody will _require_ you to declare
> types.  But you will not be able to write calls such as:
> 	lists:map(gazonk, []).
> and expect them not to throw an exception at *runtime*.
>  > What the motivation is for having stricter type checking in Erlang?
> So that people who choose to do this, can.
> Best,
> Kostis

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list