(note: this repsonse arrived just in my mailbox, not to the list, but I
thought I'd post my response to the list.  -Miko)

> Okay, that's if you can store the results somewhere all at once, but
> so was your example.  Iteration objects could be used to optimize for
> the case where you can't (or don't want to) store all of the results.

Not necessarily.  The loop constructs would work equally well with while
loops where one thing is retrieved at a time:

  while (my $record = $query->fetch_row_hashref ) {
  }

  between {
    # output separator
  }

> $res = $obj->getone;
> if ($res) {
>    # output header
>    while ($res) {
>       # loopy code here
>       $res = $obj->getone;
>    }
>    # output footer
> } else {
>    # no loop
> }

Eesh... I've always prefered to get the next thing in one place.  It seems
redundant to me to get it in two different places.


> With the syntax you've proposed there's no conceptual tie between the
> "before", "after", "between", and "noloop" constructs and the loop they
> are associated with.

They are associated the same way that an is, elsif, and else are associated,
or a try - catch - finally.  I.e., you don't put anything in between them.


> Also, are you sure you want the "between" to be in
> a separate lexical scope from the loop?

No, I'm not sure, but I think it makes more sense than putting it inside the
loop.. if it's inside is it associated with the loop before or the loop
after?  Maybe there is a elegant way to allow the iteration to pass
information to the between loop.

-Miko


Reply via email to