In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Matt Diephouse) wrote:
>On Sat, 04 Dec 2004 08:59:24 -0700, David Green <[EMAIL PROTECTED]> wrote:

>C<does Iterate> signifies a role named "Iterate". Roles are sort of a
>mix of interfaces and mixins (as I understand it -- I'm still waiting
>for E12). So saying a class fulfills a role just means that it
>provides certain methods. In this case, I was saying class with the
>Iterate role would provide a C<.next> method.

I thought of that at first, but I don't want to have to call my 
iterating method "next" any more than I want to *have* to call my 
constructor "new".  But there is a difference in that "new" is called 
by some user who is supposed to have read the documentation, whereas 
"next" needs to get implicitly called by "for".  

So maybe it really should be a Role.  (One can always provide methods 
with better names that simply call the "real" .next, .prev, .final, 
etc. for increased user-friendliness.)

    &eof := &final;    # is that how to create an alias for a sub/method?

> >We've got "while" for looping, ".next" for iterating,
> > and "for" for doing both in one convenient little shortcut.
>
>But for needs to know if it has an iterator or a list. You don't want
>it iterating over things you didn't want it iterating. In this case, I
>was suggesting making an, though I suppose something like
>C<$sth.execute> could just return one.

Well, I was looking at lists as being kinds of iterators. If you want 
to "for" over an iterator without actually iterating it, I guess 
you'd have to make a reference to it or put it inside a list (so the 
list would be iterated instead).


          - David "iterate: to go around and around, like my head" Green

Reply via email to