| Markus 2007-07-28, 7:06 pm |
|
>
> M.E.L.> In many cases the compiler will warn you about forgotten
> M.E.L.> cases -- something I imagine the Lisp systems must have
> M.E.L.> difficulties with owing to the dynamic type system.
>
> In Erlang (which is dynamically typed), the compiler warns about
> clauses that can never match, and a companion tool called Dialyzer
> (part of Erlang/OTP) does dataflow analysis on programs,
> collecting type information, and warns about all sorts of things,
> such as unreachable code, calling a function with incompatible types,
> etc. Since the language is dynamic, even Dialyzer can't warn against
> forgotten cases -- there is no template from which to judge that,
> other than the derived signatures of the call sites. Thus, Dialyzer
> can often tell whether a function is calling another using a type
> that is not handled.
Yes, I thought that a dynamically typed language can get that feature
with a data flow analyzer -- therefore I wrote "difficulties" instaed
of "impossible", the choice of words was intentional.
If I see it right, data flow analysis is tightly related to automatic
type derivation. Indeed I like the idea that one can get an untyped
language and the type systems as external tools to be applied at will
and where needed. I understood Qi to be exactly such a system. The
only problem I see, is, that typing also directs the compiler in
optimization and choosing data representations (or should/does in a
language like ML). I don't see a simple way to do that with
"pluggable" systems, so the runtime would have to be like the runtime
of Scheme and support dynamic types. That is perhaps not a problem, I
don't know, but it's one of the points where I could imagine such a
system to fail / become inefficient. But I might be wrong. There is
certainly much research still to be done and it's a pity that the
adoption of new and better languages in the industry (not your
company, certainly) is so glacial.
Regards -- Markus
|