Re: More static type fun.

From: Mark Carroll (markc_at_chiark.greenend.org.uk)
Date: 11/18/03


Date: 18 Nov 2003 20:30:36 +0000 (GMT)

In article <znettu52.fsf@ccs.neu.edu>, Joe Marshall <jrm@ccs.neu.edu> wrote:
>Andreas Rossberg <rossberg@ps.uni-sb.de> writes:
(snip)
>> No, that's the whole point. Everything in the program remains statically
>> typesafe. The only operation that can fail is the typecase, if it is
>> allowed to be non-exhaustive (which, of course, is statically detectable).
>
>Um, yeah. A non-exhaustive typecase *could* throw an error at
>runtime. Exactly how is this `static'? Exactly how is this
>`typesafe'? Exactly how does this differ from Lisp throwing a runtime
>error?

Well, it's at least statically detectable: it differs from Lisp
throwing a runtime error because the compiler can guarantee to warn
you of the eventuality, and you don't have to happen to hit exactly
that case in your unit tests or whatever to get that warning. Of
course, you can still wrongly convince yourself that that omitted case
may never be exercised, but at least you had your attention drawn to
the issue.

Still, that's only one class of error. There's all manner of runtime
errors that can crop up in a Haskell program, of course, that you may
not have been warned by the compiler about. "f = head []" will compile
yet throw a runtime exception, for example. Static typing only goes so
far.

-- Mark



Relevant Pages

  • Re: Java connected Lisp
    ... versions of GNU Classpath and SBCL, ... Invent a nice and fast interface for calls from Lisp to Java and back. ... The trick could be to hack the compiler so that it recognizes accesses ... Rewrite the "compiler" ...
    (comp.lang.lisp)
  • Re: Reflections on a classic Lisp Paper
    ... its Lisp-1 semantics than defmacro, but would not serve CL as well. ... fexprs into those languages. ... this was the Lisp Machine's philosphy that led to offering ... do changes that the compiler cannot know, ...
    (comp.lang.lisp)
  • Re: Which programming language is better to start
    ... How does Lisp handle monomorphic types? ... If you don't specify a variable to have a type then the compiler ... ML does a lot of pattern match optimisations which, ... These operation would be done by representing the data as lists ...
    (comp.programming)
  • Places=lvalues and Pop11 (was months ago: Requesting advice how to clean up C code for vali
    ... there are equivalence classes of values modulo ... In fact the optimizing compiler could eliminate the ... character, or EBCDIC character, or IBM-PC character, or Latin-1 ... and I'm pleased you've essentially adopted the lisp ...
    (comp.lang.c)
  • Re: Which programming language is better to start
    ... >>> As a performance measure a common lisp compiler will assign static ... How does Lisp handle monomorphic types? ... ML does a lot of pattern match optimisations which, ... Complete monomorphisation isn't common in the ML world, ...
    (comp.programming)

Loading