#1932: rakudo on parrot RELEASE_2_11_0-656-g27c0799 executes main body twice
---------------------+------------------------------------------------------
Reporter: moritz | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: none | Version: 2.11.0
Severity: release | Keywords:
Lang: | Patch:
Platform: |
---------------------+------------------------------------------------------
Comment(by pmichaud):
Part of the problem may be that :load subs are being executed even when
being loaded outside of the load_bytecode opcode (which goes against PDD
19).
{{{
$ cat x.pir
.sub 'first'
say 'first'
.end
.sub 'load' :load
say ':load'
.end
$ ./parrot x.pir
:load
first
$
}}}
Here we can see that the :load sub is being invoked even when not loaded
via load_bytecode.
NQP and Rakudo have to generate :load subs at the end of each module to
automatically invoke the module's mainline when the module is loaded via
load_bytecode. Since :load subs are now being invoked even for the
initial program file or when compiled in memory (which is the province of
the :init flag), the mainline gets executed "twice".
Pm
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1932#comment:3>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets