[Types-sig] Optionality and performance

Paul Prescod paul@prescod.net
Sat, 18 Dec 1999 11:06:10 -0600

Greg Stein wrote:
> Skip Montanaro wrote:
> > I humbly assert this train of thought rates a *bzzzt*.  I thought one core
> > requirement was that all type declaration stuff be optional.  The worst that
> > the type checker/inferencer should do in the face of incomplete type info is
> > display a warning.

> My entire post was pre-conditioned on the assumption that type-checking
> has been enabled.

Optionality of type checking is not about it being enabled or disabled.
Even when it is enabled, type checking any particular method must be
optional. This whole discussion should presume "enabled". But
optionality is still important.

> IMO, type checking is NOT enabled by default. I believe it will impose a
> noticable performance penalty and I'm not willing to pay that in the
> general case. 

I don't see how we can logically treat type checks differently than
array bounds checks, overflow checks and so forth. It needs to be on by
default and we'll just need to figure out how to minimize its impact.
Most type checks should involve quick pointer comparisons and that will
be covered up by the other performance enhancement.

In particular, when you declare conformance to a class or interface,
method calls should no longer be string-dispatched. That means you need
interfaces to be like vtables so the type checker's job is to find the
right vtable. The type check actually comes "for free" in implementing
the name lookup optimization.

 Paul Prescod  - ISOGEN Consulting Engineer speaking for himself
Three things never trust in: That's the vendor's final bill
The promises your boss makes, and the customer's good will