[#407] New feature for Ruby? — Clemens.Hintze@...

Hi all,

27 messages 1999/07/01
[#413] Re: New feature for Ruby? — matz@... (Yukihiro Matsumoto) 1999/07/01

Hi Clemens,

[#416] Re: New feature for Ruby? — Clemens Hintze <c.hintze@...> 1999/07/01

On Thu, 01 Jul 1999, Yukihiro Matsumoto wrote:

[#418] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/01

Hi

[#426] Re: New feature for Ruby? — gotoken@... (GOTO Kentaro) 1999/07/02

Hi,

[#440] Now another totally different ;-) — Clemens Hintze <c.hintze@...>

Hi,

21 messages 1999/07/09
[#441] Re: Now another totally different ;-) — matz@... (Yukihiro Matsumoto) 1999/07/09

Hi,

[#442] Re: Now another totally different ;-) — Clemens Hintze <c.hintze@...> 1999/07/09

On Fri, 09 Jul 1999, you wrote:

[#443] — Michael Hohn <hohn@...>

Hello,

26 messages 1999/07/09
[#444] interactive ruby, debugger — gotoken@... (GOTO Kentaro) 1999/07/09

Hi Michael,

[ruby-talk:00468] Re: Now another totally different ;-)

From: gotoken@... (GOTO Kentaro)
Date: 1999-07-12 10:48:14 UTC
List: ruby-talk #468
In message "[ruby-talk:00467] Re: Now another totally different ;-)"
    on 99/07/12, Yukihiro Matsumoto <matz@netlab.co.jp> writes:
>|And whether it has a different meaning or not, depends from your
>|point of view! You may see it as: The method `[]' delivers the
>|element stored under the index. Array elements are indexed by its
>|position, Hash elements by its key, etc. So `[]' works equal to both
>|classes. Or what do you think?
>
>Hmm, I'm curious what others think about this matter.
>Don't care?

If I may use metaphor, `[]' reminds me a baggage keeper, who fetches a
specified baggage from a storeroom. On the other hand, `each' is her
own way to treat in the storeroom one by one. In this sense, I think
that `[]' doesn't have the natural relation to `each' for caller-side,
because `each' is just a receiver's business and I hope that `[]' does
NOT depend on such an internal action. I don' wanna specify a object
by a magic number!

Indeed, I often define `Integer[1.0]' instead of `Integer(1.0)', 
# Do you remember it, Matz?

or My::Matrix[Float] to make a Matrix class which is restricted its
contents to Float.  Even in this cases, they can be considered
enumerable if I define `each' for them.

Of course, one can define `[]' via `each'. I can't ban doing that :-)

# Don't be fed up with my obstinacy, Cle. 

-- gotoken

In This Thread