#1028: can't iterate a dynlexpad
--------------------+-------------------------------------------------------
Reporter: coke | Owner: whiteknight
Type: bug | Status: new
Priority: normal | Milestone:
Component: none | Version: trunk
Severity: high | Keywords:
Lang: tcl | Patch:
Platform: |
--------------------+-------------------------------------------------------
Comment(by pmichaud):
nqp-rx has a clever(?) trick it uses to get iterable dynlexpads -- it
simply uses the 'copy' opcode to replace an existing LexPad with a Hash,
which can then be used as a dynamic lexpad.
The relevant code is in src/cheats/hll-compiler.pir, starting around line
180:
{{{
.local pmc ctx, pad
$P0 = getinterp
ctx = $P0['context']
pad = getattribute ctx, 'lex_pad'
$P1 = new ['Hash']
copy pad, $P1
}}}
The above replaces a context's existing LexPad PMC with a Hash PMC, which
is both dynamic and iterable.
Pm
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1028#comment:2>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets