Damien Neil wrote:
> 
>   sub foo {
>     my Dog $spot = shift;
>     my $fh = IO::File->new("file");
>     $spot->eat_homework($fh);
>   }
> 
> Even with the object type declared, the compiler can make no
> assumptions about whether a reference to $fh will be held or not.
> Perhaps the Poodle subclass of Dog will hold a reference, and the
> Bulldog subclass will not.

what if two GCs are maintained, a refcouting one for any lexical that
is a reference and is passed as a parameter, or that has a reference
taken of it and passed as a parameter, and a lexical-analysis one
for anything that is safe from these reference hazards.


 
   sub foo {
     my Dog $spot = shift;
     my $homework = shift;
     my $fh = IO::File->new($homework); # pass=by=value, safe to LAGC
     $spot->eat_homework($fh);  # $fh is no longer fair game for LA-GC
   }





-- 
                      David Nicol 816.235.1187 [EMAIL PROTECTED]
                                              Parse, munge, repeat.

Reply via email to