[#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: [Patch] Array#shift(n)

From: matz@... (Yukihiro Matsumoto)
Date: 2004-06-15 08:09:33 UTC
List: ruby-core #3000
Hi,

In message "Re: [Patch] Array#shift(n)"
    on 04/06/15, Michal Rokos <michal@ruby-lang.org> writes:

|>   $ ./miniruby -e 'class A<Array;end; a = A[1,2,3]; p
|> a.first(2).class' Array
|>   $ ./miniruby -e 'class A<Array;end; a = A[1,2,3]; p
|> a.shift(2).class' A
|>
|> I guess this should be consistent.
|
|It definitely should.
|
|I'd vote for 'original class'.
|
|Or: Is there any reason to downgrade it back to 'Array'?

It depends on how you define the behavior:

  if first(2) means "gives first two values (packed in array) from the
  original array", it should be Array.

  if first(2) means "returns subarray from the original array with
  first two values", it should be A.

I vote for the former.

							matz.

In This Thread