[perl #60648] :immediate-declared Classes Not Thawed from PBC
Patrick R. Michaud via RT
parrotbug-followup at parrotcode.org
Wed Nov 19 01:58:56 UTC 2008
On Tue Nov 18 16:55:30 2008, chromatic at wgz.org wrote:
> Given this PIR:
>
> .sub 'foo' :anon :immediate
> $P0 = newclass 'Bar'
> .end
>
> .sub 'main' :main
> $P0 = new 'Bar'
> $P0.'hi'()
> .end
>
> .namespace [ 'Bar' ]
>
> .sub 'hi' :method
> say "Hi!"
> .end
>
> ... the result is:
>
> Hi!
>
> Now compile it to PBC:
>
> $ ./parrot -o no_thaw.pbc no_thaw.pir
> $ ./parrot no_thaw.pbc
>
> Class 'Bar' not found
> current instr.: 'main' pc 6 (no_thaw.pir:6)
>
> See t/compilers/imcc/syn/hll.t #2 for a failing test.
It's my understanding (from pdd19 and docs/pmc/subs.pod) that the above
is in fact the correct behavior -- :immediate subs only run
automatically when compiled, and not when "loaded" from either the
command line or via a load_bytecode op.
To get the above to work even when run from the command line, add the
:init flag to 'foo'.
Pm
More information about the parrot-dev
mailing list