At 09:18 PM 8/24/2001 -0700, Brent Dax wrote:
>I meant that, if we
>know $spot is supposed to have a Dog in it, can we avoid checking if it
>really does (at least some of the time) and maybe shuck some overhead by
>doing so?  Perhaps we only check after each assignment to $spot, and
>when we check we set a flag saying that it's already been typechecked so
>we don't have to do it again.

Something like that, yep. Variables that are typed won't let you assign 
things that won't fit into them.

When you do:

    my Dog $spot;

perl will know that $spot is a Dog, and won't check at runtime if that's 
the case, and will probably do some optimization based on the knowledge of 
$spot's Dog-ness.

You won't, generally speaking, be able to lie to the compiler/interpreter. 
(Leave things unspecified, sure, but not to lie)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to