[Types-sig] Issue: definition of "type"

Paul Prescod paul@prescod.net
Mon, 20 Dec 1999 07:28:18 -0600


Tim Peters wrote:
> 
> > spam is a class but not a static type.
> 
> True, but it can be given a static type *name*; e.g.,
> 
>     decl type spam
> 
> Provided that the attributes of spam actually referenced outside of spam
> have the same signatures, static type checking outside of spam shouldn't
> care that it doesn't know about spam's internals.  Or, IOW, if the two
> dynamic versions of spam present the same external interface to the
> compiler, it doesn't matter how the *class* spam comes into being at
> runtime.

Okay, but do you or do you not agree that in the simple case of:

class spam:
	def a(self) -> String:
		return "abc"

a type object should be made implicitly as if someone had actually typed
in the decl. I certainly would not support a position that said that the
entire signature of spam had to be re-declared. I MIGHT support a
position that said that the user had to explicitly declare spam as being
available to the static type system.

I'm on the fence about this last requirement because I would like to
think that all of the code out there with class statements is *already*
defining a bunch of types. A minority of it depends on runtime
information and we can easily detect those cases. So why not let the
simple case of "defined class that doesn't depend on runtime
information" be a shortcut for a type declaration?

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
The occasional act of disrespect for the American flag creates but a 
flickering insult to the values of democracy -- unless it provokes 
America into limiting the freedoms that are its hallmark.
           -- Paul Tash, executive editor of the St. Petersburg Times