On 07/13/2011 10:00 PM, Parrot Raiser wrote:
> The following program:
> 
> my $skeleton = "bones\n";
> my $new_file = "grave";
> my $handle   = open($new_file, :w);
> $handle.print($skeleton);
> 
> opens the "grave" file, but leaves it empty. A last line:
> 
> close($handle);    # "close()" generates an error message.
> 
> is required to get any contents in the file, unlike the equivalent Perl 5 
> code:

That's because Rakudo isn't yet able to execute any code (like a DESTROY
method in Perl 5) when the garbage collector detects that an object is
not referenced anywhere anymore. So it's a limitation in Rakudo, not a
change in the language.

An intrinsic difference is that Perl 5 guarantees a timely execution of
such methods (because it is reference counted), whereas Perl 6 does not.

Question to the Parrot developers: How could I implement DESTROY methods
in Rakudo? Is there any vtable I can override, or so? Note that such a
method might itself allocate new GCables. While not urgent, it's
important for us in the long run.

Cheers,
Moritz

Reply via email to