[Types-sig] Re: PRE-PROPOSAL: Python Interfaces

Gordon McMillan gmcm@hypernet.com
Sun, 22 Nov 1998 23:01:59 -0500


[Guido]
> I think I understand John Skaller's argument better now.  He's
> objecting against the threat that (e.g.) functions which work fine
> with any kind of -- abstractly defined -- integers might be littered
> with 'int' declarations all over, restricting them to 32-bit machine
> ints.  His counterproposal (protocols) is very similar to Jim
> Fulton's interfaces proposal, as many have noticed.  There is
> probably some truth in his fear -- those who like to add type
> annotations for performance reasons (e.g. Jim Hugunin) would like to
> annotate code with type declarations that will allow a compiler to
> generate the "obvious" Java code.

Jim (and someday, SPython) can already determine that a number used 
internally to a function may be optimized to a (primitive) int. 
Conceivably, if the arg is always used as a (primitive) int, it can 
be optimized to be converted only once.

On much shakier ground (and with less payback) an abstract interface 
could still yield optimizations, at the cost of a core dump instead 
of an exception when violated.

> I think we can dream up a sufficiently rich set of interfaces to
> make everyone happy.  

I like the (elided) proposals, but some people are only happy when 
they're unhappy, (or they're making someone else unhappy <wink>).

Not pointing any fingers.

well-maybe-one-ly 'yrs

- Gordon