Python from Wise Guy's Viewpoint

Adrian Hey ahey at NoSpicedHam.iee.org
Thu Oct 23 16:26:11 EDT 2003


Pascal Costanza wrote:

> Adrian Hey wrote:
>> I've been using statically typed FPL's for a
>> good few years now, and I can only think of one occasion where I had
>> "good" code rejected by the type checker (and even then the work around
>> was trivial). All other occasions it was telling me my programs were
>> broken (and where they were broken), without me having to test it.
>> 
>> This is good thing.
> 
> Maybe you haven't written the kind of programs yet that a static type
> system can't handle.

Your right, I haven't. I would say the overwhelming majority of programs
"out there" fall into this category. I am aware that some situations are
difficult to handle in a statically typed language. An obvious example
in Haskell would be trying to type a function which interpreted strings
representing arbitrary haskell expressions and returned their value..

        eval :: String -> ??

If this situation is to be dealt with at all, some kind of dynamic
type system seems necessary. I don't think anybody is denying that
(certainly not me).

>> As for dynamics, I don't think anybody would deny the usefulness of a
>> dynamic type system as a *supplement to* the static type system.
> 
> I don't deny that static type systems can be a useful supplement to a
> dynamic type system in certain contexts.

I don't think anybody who read your posts would get that impression :-) 
 
> There is an important class of programs - those that can reason about
> themselves and can change themselves at runtime - that cannot be
> statically checked.

Yes indeed. Even your common or garden OS falls into this category I
think, but that doesn't mean you can't statically type check individual
fragments of code (programs) that run under that OS. It just means
you can't statically type check the entire system (OS + application
programs).  

> Your claim implies that such code should not be written,

What claim? I guess you mean the one about dynamic typing being a
useful supplement to, but not a substitute for, static typing.

If so, I don't think it implies that at all.

> at least not "most of the time" (whatever that means).

Dunno who you're quoting there, but it isn't me.

> Why? Maybe I am missing an important insight about such programs
> that you have.

Possibly, but it seems more likely that you are simply misrepresenting
what I (and others) have written in order to create a straw man to demolish.

Regards
--
Adrian Hey













More information about the Python-list mailing list