[Types-sig] how to do a typecase? (was: Static typing: Towards closure?)

Guido van Rossum guido@CNRI.Reston.VA.US
Fri, 21 Jan 2000 11:33:45 -0500

> From: Greg Stein <gstein@lyra.org>

> In certain cases, the code at the top of this email could be accepted, but
> to wire that into the definition would imply too many rules and
> restrictions (instead of the simple definition for '!' that you just
> provided).

It is *not* acceptable that whether a program is considered typesafe
depends on particulars of the typechecker implementation (except where
limits on program size etc. are concerned).

Saying that a particular construct is defined as not typesafe, but
that a smarter typechecker might allow it anyway if it sees that in
this case there are no problems, is asking for trouble: people using
the smarter typechecker will innocently publish code that they think
is typesafe while actually it isn't.

True, this is always a risk when you have multiple implementations of
the same set of complex rules, but we shouldn't build this attitude
into our definition of the typechecker.

> And relegating the problem to the optimizer to remove the runtime checks
> is perfectly fine with me.

That's of course the solution.

--Guido van Rossum (home page: http://www.python.org/~guido/)