[erlang-questions] Why isn't erlang strongly typed?

Robert Virding rvirding@REDACTED
Tue Oct 21 20:41:37 CEST 2008

I think a lot of confusion here among different issues:

- Erlang is strongly typed, you cannot get around the type system and
functions complain (generate exceptions) when they don't get the right types
- It is, however, dynamically typed and not statically typed in that the
types are checked at run time and not at compile time
- If you deem the documentation and function arguments/returns to be
confusing this has absolutely nothing to do with typing, whether strong,
weak, static or dynamic.

That it is dynamically typed really does help with hot code loading.
Otherwise you either have static and unchangeable module interfaces or you
could get a system which is *really* unsafe, a function is called with one
data type and thinks it is getting another and doesn't check as it knows the
compiler has checked. Distribution makes this problem worse.

I will freely admit that some of the functions don't always have intuitive
arguments, are inconsistent or otherwise don't uphold the principle of least
surprise. One reason for this is that the system evolved rather freely over
time and many things (useful) things were just added to the system without
much consideration for consistency and such. And, as everyone who has tried,
knows changing things afterwards is *not trivial*.


2008/10/21 Steve Davis <steven.charles.davis@REDACTED>

> On Oct 21, 9:45 am, Rapsey <rap...@REDACTED> wrote:
> > I don't understand. What does this have to do with the language being
> > strongly typed?
> Well, the way I think about it is that types let you define what the
> function expects, and what you can expect in return. So it would
> provide a contract or agreed protocol in a far more cohesive way that
> is possible right now in erlang (cf. "spec" and "record"). Types would
> speed up coding as it would avoid you having to dig around in every
> function's source to see what you should expect in return. There's
> probably some fatal flaw in this thinking -- which is why I asked the
> question :)
> /s
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081021/d64537c2/attachment.htm>

More information about the erlang-questions mailing list