develooper Front page | perl.perl6.language | Postings from August 2001

RE: Will subroutine signatures apply to methods in Perl6

Thread Previous | Thread Next
Dan Sugalski
August 25, 2001 12:00
RE: Will subroutine signatures apply to methods in Perl6
Message ID:
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)


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

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About