[erlang-questions] Runtime checking for types
Jesper Louis Andersen
jesper.louis.andersen@REDACTED
Mon Apr 18 12:58:34 CEST 2011
On Mon, Apr 18, 2011 at 01:07, Steve Davis
<steven.charles.davis@REDACTED> wrote:
> IMHO, a focus on type-safety can lose you a truly *massive* amount of
> time that could be spent doing something useful.
There are many intricate dependencies which you can't simply resolve
in a few moments of thought on that one. The point of type safety is
to trade a short-term added specification for a long-term benefit. You
write down a precise expression of intent with the type, and being
precise takes more time. But it is extremely helpful over the course
of larger programs, provides (checkable!) documentation, yields more
effective execution trivially and so on.
The initial ignorance of static types in Erlang is understandable.
Other things were more important to get right and history was such
that we did not understand certain parts of the intermingling of types
with distribution etc.. But today, I feel there is no excuse. Should I
design a modern Erlang, I would start with a statically typed world in
which communicaiton use polymorphic variants. Essentially: An internal
process is statically typed, but communicate in a dynamically typed
setting. Thus, I have lost *nothing* compared to Erlang, but I can
compile processes to be an order of magnitude faster, trivially. From
there, I can probably define a channel-primitive between processes
with static type constraint such that processes can intercommunicate
in a type-safe way. Perhaps even with a shared-persistent-heap
semantics.
Remember, dynamic typing is a straitjacket, in which you cannot fully
express yourself, whereas static typing give you a rich language for
doing so.
--
J.
More information about the erlang-questions
mailing list