[perl #60648] :immediate-declared Classes Not Thawed from PBC

Will Coleda via RT parrotbug-followup at parrotcode.org
Sun May 17 21:30:22 UTC 2009


On Tue Nov 18 17:58:53 2008, pmichaud wrote:
> 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

I agree with Pm; :immediate subs are executed as soon as they are 
compiled, and to get the behavior you want, :init should work.

Rejecting this ticket - if you feel strongly about this, chromatic, 
please open a new ticket via trac or bring it up at the next #ps.



-- 
Will "Coke" Coleda


More information about the parrot-dev mailing list