On Sun, Jul 17, 2011 at 10:21:19AM +0200, Moritz Lenz wrote:
> 
> 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.

A possibly related (and more relevant) question for Parrot devs:
is there any reason that FileHandle PMCs do not automatically 
flush + close on destruction?

    pmichaud@kiwi:~/nom$ cat fh.pir
    .sub 'main' :main
        $P0 = new ['FileHandle']
        $P1 = $P0.'open'('test.txt', 'w')
        $P1.'print'("Hello\n")
    .end
    
    pmichaud@kiwi:~/nom$ install/bin/parrot fh.pir
    pmichaud@kiwi:~/nom$ cat test.txt
    pmichaud@kiwi:~/nom$ ls -l test.txt
    -rw-r--r-- 1 pmichaud pmichaud 0 2011-07-17 09:57 test.txt

Pm

Reply via email to