|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-11-15 18:32:09
Brian McNamara <lorgon_at_[hidden]> writes:
> Dynamic typing advocates say they don't need type systems because type
> errors are not a practical problem. Why not? Because dynamic typers
> are more accustomed to writing suites of unit tests. These unit tests
> not only test the (content-)functionality of their programs, but they
> also have the side-effect of flushing out "type errors". As a result,
> dyanmic typers don't see the need for static type systems, since they
> already have tools in their tool-suite which find these errors anyway.
<partisan>
But, as much as I enjoy some dynamically-typed languages, I find they
lose in maintainability and understandability because nobody takes the
time to write the comments that correspond to abstract type
declarations (type classes/comments), and when they do, they're
usually imprecise and/or wrong. For example, a conscientious Python
function author may advertise that you can pass any sequence of values
when in fact something has crept into the code which makes it depend
on the sequence actually being a Python list. Most authors, though,
either don't want to be bothered with what they consider to be
"distasteful type declarations" translated into English, or don't want
to take the risk of over-promising as above, so they just don't
bother.
</partisan>
> In that context, if you ask me "what is an archetype?" I will answer
> "it is the unit test designed to find the 'type errors' in C++
> template code".
Yep.
> (where 'type errors' means those kinds of errors that a real concept
> system would uncover--the same kinds of errors uncovered by a
> Haskell compiler when type-classes/instances/constraints are abused)
Yep.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk