On Thu, 19 Oct 2006, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "Re: String not enumerable, what about IO? (was Re: Symbol < String in Ruby > 1.8)"
>     on Thu, 19 Oct 2006 20:36:28 +0900, dblack / wobblini.net writes:
> 
> |That kind of steering away from the semantics of the method names
> |makes me uncomfortable.  If I need an enumerator, I want the language
> |to give me a way to ask for one clearly; and if I ask for "things", I
> |want the things.
> 
> Hmm, maybe the name Enumerator does not make you feel like it's a
> collection.  What if Enumerator is renamed to some other name, for
> example, DelayedCollection or something?

It seems to me to be behaving more like a generator, though you can
tell it how many things to generate.  So what if you borrowed Icon's
suspend method name, and if that had a block it worked like each, without
a block it just gives you the next item, until Enumerator#finished? were
true.  That way you can still get a bunch of Nils from it, if you wish.
Furthermore, the expectations for each don't change. 

I see one problem with this: Icon's suspend is a resumable return. It's
like an inside out yield.  What would Python call it?

However, thinking of these things as Generators rather than
Enumerators, might allow us to think of something else that's more
like what they really are.  I'm not currently fluent in Python
Generators, so don't know if analogies from there might help.

I'm probably off base, being unfamiliar with these newer bits of 
Ruby, so I hope this "modelling it as something else" idea itself
is of use, even if my choice of model is not.
> 
> 							matz.
> 
> 
        Hugh