[Types-sig] Typesafe

John Ehresman jpe@arachne.org
Tue, 4 Jan 2000 16:32:30 -0500 (EST)


What is the definition of typesafe and what is the definition of isa (or
"!" or whatever)?  I ask because I thought typesafe meant no code in the
function could raise a type-related exception (TypeError or
AttributeError), but I don't think the following meets that criteria:

> On Tue, 4 Jan 2000, Paul Prescod wrote:
> But then other times I write hundreds of lines of mission critical code
> and I want a little help to guarantee that it does what I think:
>
> typesafe def getprop( foo, prop ):
>   10,000 lines
>   return WebDAVGetPropertyThatIKnowIsAString( foo, prop ) isa String

Am I missing something?  If my definition of typesafe is not correct, can
someone define it in terms of what exceptions can be thrown at runtime?

Also, at least one version of the RFC defined the type assertion operator
as raising a subtype of AssertionError if the type of the value is
incorrect; does this imply that the exception will only be raised in debug
mode, like the AssertionError is?  I think you would want it to apply in
non-debug mode also so that optimized code can safely generated.

John