Newsgroups: | comp.compilers |
From: | tmb@arolla.idiap.ch (Thomas M. Breuel) |
Organization: | IDIAP |
Date: | Tue, 12 Jan 1993 22:59:32 GMT |
Keywords: | debug, types |
References: | 93-01-041 93-01-065 |
nickh@CS.CMU.EDU (Nick Haines) writes:
> An SML program which successfully typechecks will not
> bomb [due to type errors] at runtime.
jlg@cochiti.lanl.gov (J. Giles) writes:
Then your programs are considerably different from what I'm familiar with.
Most errors are not syntactic or static semantic errors (like type errors).
Actually, both of you are probably right.
For example, in FORTRAN, most programming mistakes don't show up as type
errors. The reason is that the FORTRAN type system isn't very expressive,
relying on arrays of numbers to represent many different kinds of data
structures (this kind of programming style is often carried over by its
practitioners to other languages; see, for example, "Numerical Recipes in
C").
The SML type system, however, lets the programmer tell the compiler a lot
about his data structures and their interrelationships. This means that
if you take advantage of the added expressiveness of the SML type system,
many errors that are not type errors in most other languages will be
caught by the type checker.
So, extensive static typechecking alone doesn't automatically find more
errors in your programs. You also need an expressive type system, and you
need to use it.
Incidentally, having reimplemented a number of FORTRAN programs in SML, my
impression is that even hardcore numerical programs benefit greatly from
use of a more expressive type system.
Thomas.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.