[Types-sig] Re: [Python-Dev] Revive the types sig?

Michel Pelletier michel@digicool.com
Sun, 11 Mar 2001 18:05:48 -0800 (PST)

On Sun, 11 Mar 2001, Paul Prescod wrote:

> Let's discuss my proposal in the types-sig. Executive summary:
>  * incremental development policy
>  * syntax for parameter type declarations
>  * syntax for return type declarations
>  * optional runtime type checking
>  * goals are better runtime error reporting and method documentation

I could be way over my head here, but I'll try to give you my ideas.

I've read the past proposals for type declarations and their
syntax, and I've also read a good bit of the types-sig archive.

I feel that there is not as much benefit to extending type declarations
into the language as their is to interfaces.  I feel this way because I'm
not sure what benefit this has over an object that describes the types you
are expecting and is associated with your object (like an interface).

The upshot of having an interface describe your expected parameter and
return types is that the type checking can be made as compile/run-time,
optional/madatory as you want without changing the language or your
implementation at all.  "Strong" checking could be done during testing,
and no checking at all during production, and any level in between.

A disadvantage of an interface is that it is a seperate, additional step
over just writing code (as are any type assertions in the language, but
those are "easier"  inline with the implementation).  But this
disadvantage is also an upshot when you immagine that the interface could
be developed later, and bolted onto the implementation later without
changing the implementation.

Also, type checking in general is good, but what about preconditions (this
parameter must be an int > 5 < 10) and postconditions and other conditions
one does now with assertions.  Would these be more language extensions in
your propsal?

As I see it, interfaces satify your first point, remove the need for your
second and third point, satify your fourth point, and meet the goals of
your fifth.

Nice to meet you at the conference,