Static typing (was Re: Java guy interested in Python)

Michael Hudson mwh21 at cam.ac.uk
Sun Mar 11 10:56:08 EST 2001


=?iso-8859-1?q?Hamish=20Lawson?= <hamish_lawson at yahoo.co.uk> writes:

> Michael Hudson:
> 
>     I suspect that you'd basically end up listing the methods required,
>     eg:
> 
>     def func(file : <has 'write', 'read', 'seek'>, ...): pass
> 
>     I'm not sure that makes a "type system".  Hmm.  More thinking
>     required.
> 
> Not sure that makes a type system? Isn't that what the modern
> understanding of a type is - a list of operations that are expected to
> be supported, as with Java's idea of interfaces being distinct from
> classes? 

Well, what I really meant was, I'm not sure that going down this road
would gain anyone anything.  I agree it might; but I certainly don't
think it's a given.

> I actually thought your example showed an interesting idea -
> anonymous, defined-on-the-fly interfaces. (That is, if static typing
> is wanted.)

Of course, a problem is that an object having attributes called
"write", "read" and "seek" is one thing, but these attributes in fact
being methods that interact in the desired manner is something else.

Cheers,
M.

-- 
 Very clever implementation techniques are required to implement this
 insanity correctly and usefully, not to mention that code written
 with this feature used and abused east and west is exceptionally
 exciting to debug.       -- Erik Naggum on Algol-style "call-by-name"



More information about the Python-list mailing list