Hi -

On Thu, 19 Oct 2006, Rick DeNatale wrote:

> On 10/18/06, dblack / wobblini.net <dblack / wobblini.net> wrote:
>
>> I think so, but I think also my comment was misunderstood as "no
>> method, of any name, should ever return an enumerator." :-)  The part
>> I'm not comfortable with is, indeed, the method names.  each_* not
>> taking a block strikes me as odd; I'm not convinced the "each" naming
>> would ever have been used in the language if not for blocks, and I
>> don't think it retrofits very well.  lines sounds like a collection.
>
> Well, the idea of each* returning an enumerator if a block is not
> given is new in 1.9 and I rather like it.
> http://talklikeaduck.denhaven2.com/articles/2006/10/15/enumeration-improvement-in-ruby-1-9

I know it's new in 1.9, and I don't like it.  I don't understand at
all why:

   collection.each

would be expected to return an Enumerator.  I find it very obscure.
"each" makes much more sense, I believe, as a method that takes a
block and iterates through a collection.  I'd rather see the non-block
version continue to raise an exception, simply because that's the only
thing that consistently makes semantic sense.


David

-- 
                   David A. Black | dblack / wobblini.net
Author of "Ruby for Rails"   [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog)        [2] | Co-director, Ruby Central, Inc.   [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org