Hi --

On Sat, 21 Oct 2006, mathew wrote:

> On 10/19/06, dblack / wobblini.net <dblack / wobblini.net> wrote:
>> each still feels like an odd way to ask for an Enumerator.  I'd expect
>> to call a method with "enum" in the name.  The automatic Enumerator
>> seems to me to be a kind of "magic dot" technique -- not that there's
>> anything technically obscure about it (it's clear how it returns the
>> Enumerator), but it takes away the ability to parse the code
>> left-to-right based on the actual meanings and semantics of the method
>> names.
>
> I disagree. I think if you are OK with the idea of functions/methods
> being objects just like any other, there's nothing obscure about it at
> all, the parsing is quite straightforward.
>
> f = [1, 2, 3].each is simply assigning a value to f; the value happens
> to be a piece of code which has some internal state and which will
> return each value from the array in turn.

I understand how it works technically; I really don't like "each" as a
method name for this.  My more general qualms about the automatic
Enumerator are really tied into the method naming.


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