[Types-sig] Re: [Python-Dev] Revive the types sig?
Paul Prescod
paulp@ActiveState.com
Sun, 11 Mar 2001 22:35:28 -0800
Michel Pelletier wrote:
>
> I could be way over my head here, but I'll try to give you my ideas.
You're not over your head and I'd like to invite you to the types-sig.
> 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).
I strongly believe that interfaces are a Good Thing. If you DC guys
weren't working on them I'd spend my own time working on them. But they
in no way solve the problems of the rest of the types-sig. There are
many open problems:
* what is the syntax for describing parameters to an interface?
* what is the type hierarchy (or dag) underlying that syntax?
* how do we unify the type, class and interface worlds?
* how do we specify the parameters of functions that are NOT on
classes.
* how do we specifry the parameters of classes that do NOT have
associated interfaces?
> ...
> 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.
Agreed. There are good reasons for wanting "inline" declarations (ease
of programming and prototyping) and good reasons for wanting separate
interfaces (especially for reuse). I think that this is a strong
argument that we should support both.
> 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?
One of my governing philosophies about type systems is that you can
always make them more complex/sophisticated. I don't see that pre and
post-conditions are so important that they need first-class syntax.
Assertions are sufficient.
> 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.
To recap:
> * incremental development policy
Fine.
> * syntax for parameter type declarations
How do we do parameter type declarations in scarecrow?
> * syntax for return type declarations
How do we do return type declarations in scarecrow?
> Nice to meet you at the conference,
>
> -Michel
Likewise!
--
Python:
Programming the way
Guido
indented it.
- (originated with Skip Montanaro?)