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

One thing I started doing was hacking Want to include an ITERATIVE context. The author had given me ideas on how and I may finish it yet but this seemed cleaner than examining the op tree.

-Lee

"To be civilized is to deny one's nature."
  • Comment on Re:(5) Iterating & Playing with Caller's Pads

Replies are listed 'Best First'.
Re: Re:(5) Iterating & Playing with Caller's Pads
by Elian (Parson) on Oct 18, 2002 at 16:23 UTC
    How would you identify iterative context? (Tell me and we might get it implemented...)
      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.