[#3006] CVS repository — "Eugene Scripnik" <hoaz@...>

Hello.

21 messages 2004/06/16
[#3008] Re: CVS repository — ts <decoux@...> 2004/06/16

>>>>> "E" == Eugene Scripnik <hoaz@gala.net> writes:

[#3009] Re: CVS repository — Michal Rokos <michal@...> 2004/06/16

Hi!

[#3057] Ruby 1.8.2 to be released. — matz@... (Yukihiro Matsumoto)

Hi,

20 messages 2004/06/23

Re: entries / to_a

From: Joel VanderWerf <vjoel@...>
Date: 2004-06-03 19:21:23 UTC
List: ruby-core #2963
Johan Holmberg wrote:
> Hi !
> 
> The Enumerable module defines the two methods "entries" and "to_a"
> as synonyms for the same thing. Some classes that mix-in Enumerable
> re-implement "to_a" but *not* "entries". Sometimes this is ok, but
> in the case of the Array class I think this is a bad thing.

It might be valuable to have both functionalities available. If #entries 
consistently means "Return a new array containing the items in _enum_.", 
then you can always be sure you're getting a copy. There may be code 
somewhere that relies on this behavior.

Unfortunately, the ri docs say "Returns an array containing the items in 
_enum_.", which doesn't quite settle the ambiguity. It doesn't help that 
Enumerable#to_a and Enumerable#entries share the same ri page without 
mentioning that classes that mix in Enumerable can treat them differently.



In This Thread

Prev Next