Python from Wise Guy's Viewpoint

prunesquallor at comcast.net prunesquallor at comcast.net
Sat Nov 1 10:07:53 EST 2003


Fergus Henderson <fjh at cs.mu.oz.au> writes:

> prunesquallor at comcast.net writes:
>
>>Fergus Henderson <fjh at cs.mu.oz.au> writes:
>>
>>> But the difference between dynamically typed languages and
>>> statically typed languages is that in dynamically typed languages, *every*
>>> data access (other than just copying data around) involves a dynamic dispatch.
>>> Sure, implementations can optimize a lot of them away.  But generally you're
>>> still left lots that your implementation can't optimize away, but which
>>> would not be present in a statically typed language, such as the O(N)
>>> dynamic type checks in the example above.
>>
>>That's what the type-checking hardware is for.
>
> Did you forget a smiley?

No, I never use smileys.

> In case not:  type-checking hardware has been tried already, and failed.

News to me.  I've used type checking hardware and it works like a charm.

> (Anyway, type-checking hardware would only solve part of the problem, I think.
> Dynamic type checking imposes two costs: one is the time cost of performing
> the checks, and the other is the locality cost due to the code size increase.
> Type-checking hardware avoids the code size increases, but I don't think it
> helps with the time cost of performing the checks.)

Actually it works quite well with performing the checks.  In general,
type checking is much quicker than computation, and in general it can
be performed in parallel with computation (you simply discard the
bogus result if it fails).  You don't need very much hardware, either.








More information about the Python-list mailing list