in reply to Re:(5) Iterating & Playing with Caller's Pads
in thread Iterating & Playing with Caller's Pads

How would you identify iterative context? (Tell me and we might get it implemented...)
  • Comment on Re: Re:(5) Iterating & Playing with Caller's Pads

Replies are listed 'Best First'.
Re: Re: Re:(5) Iterating & Playing with Caller's Pads
by shotgunefx (Parson) on Oct 19, 2002 at 09:36 UTC
    Excuse my ignorance as I am still very green on perlguts, but my thinking was that you could look at the ops before and after the call to see if you were called between and op_enterloop and op_leaveloop.

    I had run this by the author of Want.pm and he suggested something like the want_boolean function in Want.xs, but to look for OP_AND and it also needs to check that (o->op_next->op_type == OP_LEAVELOOP).

    I still think that in theory this take seems more correct.

    -Lee

    "To be civilized is to deny one's nature."
      Dancing through the optree for this information's a tricky thing, as a fair amount of information may be lost by the time we look for context. I was also thinking more in terms of syntactic clues--how can the parser look at the source and determine that something should be an iterator or not? If we can't tell syntactically, then it's likely not safe to be doing.