[Types-sig] type declaration syntax

skaller skaller@maxtal.com.au
Sun, 19 Dec 1999 10:05:41 +1100


Tim Peters wrote:
 
> My bet is that the vast majority of Python people asking for "static typing"
> have in mind a conventional explicit system of the Algol/Pascal/C (APC) ilk,
> and that decisions based on what *inference* schemes can do are going to
> leave them very unhappy.

I'm not sure why. My 'assumption' is that

	1) a conservative inferencer is used,
which means it tries to optimise code by inference,
but if it isn't sure, it falls back to the usual run-time
checking -- that is, it faithfully reproduces the expected
behaviour no matter what.

	2) optional static type declarations allow
the performance of the inferencer to be improved;
that is, to generate better code

	3) it would also help to tighten up
the specifications of python, particularly
in areas like

	a) when is it OK to expect an exception
	b) module freezing

etc.

I would make the point that, as often is the case,
the client is 'asking' for X, but what they actually
need is Y, because they don't understand their own requirements.
That is, they may be 'asking' for APC style static typing,
but they have no idea what the implications are,
and if they knew, they would withdraw their application.
I guess that NO python programmer wants to declare the type
of every single name, which is what APC style static type
checking requires. So they 'throw in' the word 'optional',
and that changes the whole thing to 'general inference
like in a functional programming language, only trickier,
because Python isn't' :-)

-- 
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