Ticket #1028 (closed bug: fixed)

Opened 12 years ago

Last modified 11 years ago

can't iterate a dynlexpad

Reported by: coke Owned by: whiteknight
Priority: minor Milestone: 3.0
Component: core Version: master
Severity: low Keywords: gci dynlexpad
Cc: Language: tcl
Patch status: Platform: all

Description

See the  Original RT

Attempting to iterator over a dynlexpad generates the following error:

get_iter() not implemented in class 'DynLexPad'

There's a todo test in t/dynpmc/dynlexpad.t

This is a tcl blocker for converting over to using parrot's callchain (as we'd need to use dynlexpads, and we'd need to be able to iterate over the list of available variables.)

Change History

Changed 11 years ago by whiteknight

  • owner set to whiteknight

Changed 11 years ago 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

Changed 11 years ago by whiteknight

  • status changed from new to assigned

I created the dynlexpad_get_iter branch. In aecd881 I committed some prototype code that (I think) should allow dynlexpads to be iterable. If somebody can help write a test or two for the new behavior, I think it can be tested and merged.

Changed 11 years ago by whiteknight

  • severity changed from high to low
  • component changed from none to core
  • priority changed from normal to minor
  • platform set to all
  • version changed from trunk to master
  • milestone set to 3.0
  • keywords gci dynlexpad added

I've assigned the last stage of this ticket as a GCI task.

Changed 11 years ago by whiteknight

  • status changed from assigned to closed
  • resolution set to fixed

this branch has been merged and the tests for it have been unskipped. I'm closing this ticket.

Note: See TracTickets for help on using tickets.