Patrick R.Michaud (via RT) wrote:

.sub main :main
    $P0 = open "sf8-sub.pir", "<"
    $S0 = read $P0, 65535

    $P1 = compreg "PIR"
    $P1($S0)

The return result of the compilation (an Eval PMC) isn't stored anywhere and get's GCed. This also kills the compiled subroutine.

    $P2 = $P1($S0)
    register $P2        # or store_global ...

This is maybe not the correct way to deal with compiled code, OTOH: Parrot doesn't know anything about the planned life-time of the compiled code and keeping it alive by default might be as undesriable.

leo

Reply via email to