[Types-sig] Static typing: Towards closure?

Paul Prescod paul@prescod.net
Thu, 20 Jan 2000 16:09:32 -0800


Jeremy Hylton wrote:
> 
> ...
> 
> A related worry is that the type checking will have unexpected effects
> on performance when there is an interaction between checked and
> unchecked code.  Guido showed the potentially painful example of
> passing a list containing thousands of elements from unchecked code to
> an object declared as "def (int list) -> int"; this seems to imply a
> runtime check to verify that all of the elements of the list are ints.
> I worry that there would be subtler cases with similar performance
> hits.

This is a fairly serious issue but my instinct is to say: "if you need
optimal performance, turn off runtime type checking" which you'll need
to do anyhow. This example is no worse than an O(n) assertion.

I can't, off the top of my head, think of a case when this occurs "more
subtly" but we will have to watch out for those.
-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Earth will soon support only survivor species -- dandelions, roaches, 
lizards, thistles, crows, rats. Not to mention 10 billion humans.
	- Planet of the Weeds, Harper's Magazine, October 1998