[OT] Should exist / does exist?
joel at fysh.org
Thu Dec 7 00:12:22 GMT 2006
On Wed, Dec 06, 2006 at 09:56:09PM +0000, Andy Armstrong wrote:
> That pretty much satisfies what I originally asked but doesn't help
> in the case where the iterator isn't implemented as a single loop.
> I'd really like to have the kind of loop exit communicated back to
> the iterator so it can handle it in whatever way is appropriate. For
> example the iterator might actually be recursively walking some data
> structure without even containing an explicit loop
I've got code working which can do the earlier stuff you mentioned,
except specific loop labels. I'm not so sure it couldn't do what you're
asking. I'll post it to the list if you want a look, it's basically
using a lot of sugar around eval/die though, which as I understand it
you have already got working... I have subs Next/Last/Redo which
construct Iterator::Error objects which are trapped out of $@ and acted
on appropriately. My worry is that to add the kind of tree-walking
behaviour you outline above you would have to bolt the sugar in so close
to the algorithm that you would end up with code that was less clear
overall than when you started out...
More information about the london.pm