[r6rs-discuss] [Formal] Allow compilers to reject
per at bothner.com
Sat Feb 24 21:03:31 EST 2007
Arthur A. Gleckler wrote:
> My only concern is that an error in one part of my program should not
> prevent me from running another part of the program. The thing I most
> dislike about most statically typed language implementations is that
> they prevent me from testing a program that isn't yet completely
> type-correct when I'm not even planning to invoke the broken part of the
> program. I suppose that this suggestion only allows, but doesn't
> require, compiler writers to signal errors it can detect at compile
> time. Still, I'd rather not encourage this behavior if it makes it
> impossible to run programs that are not yet completely correct.
I really don't understand this point of view. We know that it is
*much* easier to find and fix a bug the earlier it is caught. If a
compiler can automatically find a bug right after you write it,
and you don't have to write any extra code or do any extra work,
then it seems silly to not take advantage of this help.
Even if a compiler can't find *all* typing errors, or even if
it isn't fully specified or consistent which errors it catches
(to address Matthias's comment) that does not negate the usefulness
any errors it *can* catch.
That is why I tend to favor requiring all variables to be lexically
declared: it makes it trivial to catch many simple mistakes.
(This does not preclude dynamic/fluid variables - they just have to
be declare as such.) Kawa has an option to warn at compile time
about unknown variables, and it's very useful option, even for Scheme.
(Of course the argument can be extended to static typing, but here
the counter-argument is that concise and general static typing is
not a solved problem - at least there is no consensus on the solution.)
per at bothner.com http://per.bothner.com/
More information about the r6rs-discuss