[Types-sig] Core Python.... (less is more)

John Max Skaller skaller@maxtal.com.au
Thu, 13 Jul 2000 03:44:58 +1000


Daniel Wang wrote:
> 
> Hmmm given the responses, I don't think I made myself all that clear...
> 
> Baiscally it boils down to the fact that adding any sort of typing
> discipline for what ever reason to "full Python" is going to be a very hard
> thing to do. So, I'm basically asking what's a small and interesting chunk
> of the language to tackle first. 

	Like I said, you have to throw out most of the __xxx__ class members.
You might care to examine Vyper 

	http://Vyper.sourceforge.net

which is a high power version of python which aimed at providing static
typing.
It doesn't (yet). But to support reasonable interpretation, classes
can't have
__add__ methods (etc). They can have __getattr__ methods. I use
algebraic
typing, not dynamic typing (the interpreter is written in Ocaml, an ML
dialect).

> For example, I can easily see doing the procedural subset of Python without
> classes in a relatively easy way.

	Actually, Vyper provides several major extensions to Python:
they're not in the same league, really: it supports full lexical scoping
including closures, garbage collection, and algebraic pattern matching.
 
	Static typing information is already present, you can
add typing information to function arguments. However, this information
is not currently used statically.

	As I have also said, the principal problem in statically typing
python is NOT its dynamism per se, but the lack of any notion of an
error.
That is, the following code:

	x = 1/0

is perfectly correct python. There is no error here. The code is
required to raise an exception. This kind of requirement completely
defeats static typing. But then, the language 'specification' really
just says what the CPython implementation does.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net