[Types-sig] Viper Type specification

skaller skaller@maxtal.com.au
Sun, 19 Dec 1999 01:07:35 +1100


Greg Stein wrote:
> On Sat, 18 Dec 1999, skaller wrote:
> > FYI: here is the Viper file py_types.vy which defines
> > many Viper types. 

> I don't understand the relevancy of this to the types-sig and our recent
> discussions about adding static typing to Python.

The types-SIG has discussed a 'language' for types, correct?
For example, Tim Peters demonstrated a Haskell like syntax.
One property of that syntax is that it allows complex specifications,
including generics. Correct?

Well, I'm showing another way to do it. The file I posted
IS the type specification for Viper 2. With this mechanism,
there is no need for any 'language' to describe types,
the only 'language' permitted or required is 'python
expression denoting an object'. This meets the some
of the stated requirements of the SIG, and Guido,
better than any other language describing types,
in particular the 'no new stuff' requirement -- 
since it is clearly done entirely IN python.

I posted the file, mainly for interest, so people could see
what type specifications IN python would look like:
this file is the one actually used in Viper, it isn't
a 'demo', but the real thing.

I'm not saying this is 'the' solution, but it ought to
be considered because it simultaneously provides a 
powerful typing model, which is based on the existing
model with only a small generalisation, seems easy
to implement, and also solves the problem of how to name types.

I hope it is clear now, why it is relevant.

BTW: w.r.t expr!type, your (Greg's) proposal, what precedence
would your give operator ! ?

-- 
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850