Re: More static type fun.
From: Adrian Hey (ahey_at_NoSpicedHam.iee.org)
Date: 10/29/03
- Next message: Wang Yin: "Re: What's the CL equivalent of Scheme's letrec?"
- Previous message: Adrian Hey: "Re: Python from Wise Guy's Viewpoint"
- In reply to: Erann Gat: "Re: More static type fun."
- Next in thread: Erann Gat: "Re: More static type fun."
- Reply: Erann Gat: "Re: More static type fun."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Oct 2003 05:58:23 +0000
Erann Gat wrote:
> In article <m165i92awj.fsf@tti5.uchicago.edu>, Matthias Blume
> <find@my.address.elsewhere> wrote:
>> The point is that even though you might know that there are/were
>> stubs, you might not remember exactly where you used them. By getting
>> rid of the definition of the stub, you enable the compiler to give you
>> all the necessary reminders.
>>
>> (Anyway, how is that different from the dynamically typed case? It is
>> certainly not worse.)
>
> Of course it's worse. In Lisp I can do this:
>
> ? (defun branch-1 () 'foo)
> BRANCH-1
> ? (defun top-level ()
> (if (read) (branch-1) (branch-2)))
> ;Compiler warnings :
> ; Undefined function BRANCH-2, in TOP-LEVEL.
> TOP-LEVEL
> ? (top-level)
> t
> FOO
> ?
>
> Note that branch-2 being undefined did not prevent me from testing
> top-level and branch-1. If I turn this code over to someone else for
> further development they will discover that branch-2 still needs to be
> written as soon as they try to compile the code. They don't have to rely
> on me to tell them, or to follow some convention about putting stubs in a
> particular place.
>
> In a static language I have to choose: either I get the compiler error, or
> I can run the code, but I can't have both at the same time.
I think you should be careful about generalising what you percieve to
be a deficiency in the implementation of 1 particular statically typed
language as being representative of all statically typed languages,
current or future.
Unless you've actually tried using the language to write real programs
how do you know for sure. Maybe the (alleged) deficiency is actually a
carefully considered design feature.
As for the immediate problem of testing and/or typechecking of partially
written programs, it is true Haskell (and every other FPL I'm aware of)
does require you to write some kind of stub for yet to be defined
functions, but even this is not a fundamental limitation of *all*
static type systems. For better or worse, it's just the way Haskell
works, that's all.
There are other type systems and inference algorithms which can
type check incomplete programs. Given such a type system I guess
it would be a trivial matter to automatically generate appropriate
exception raising stubs so that such programs could be run and
(partially) tested.
Regards
-- Adrian Hey
- Next message: Wang Yin: "Re: What's the CL equivalent of Scheme's letrec?"
- Previous message: Adrian Hey: "Re: Python from Wise Guy's Viewpoint"
- In reply to: Erann Gat: "Re: More static type fun."
- Next in thread: Erann Gat: "Re: More static type fun."
- Reply: Erann Gat: "Re: More static type fun."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]