Project

General

Profile

Actions

Feature #10444

closed

[PATCH 3/3] Vector#[] returns new vector if argument is range.

Added by gogotanaka (Kazuki Tanaka) over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Target version:
[ruby-core:65984]

Description

Hi, it's incompatible change little bit.

Before

Vector[1,2,3][0..1]
=> [1, 2]

After

Vector[1,2,3][0..1]
=> Vector[1, 2]

I'm not in a hurry. Take your time.


Files

implement_matrix.rb.patch (1.3 KB) implement_matrix.rb.patch gogotanaka (Kazuki Tanaka), 10/29/2014 08:13 AM
add_test.patch (820 Bytes) add_test.patch gogotanaka (Kazuki Tanaka), 10/29/2014 08:13 AM
update_NEWS.patch (736 Bytes) update_NEWS.patch gogotanaka (Kazuki Tanaka), 10/29/2014 08:13 AM

Updated by marcandre (Marc-Andre Lafortune) over 9 years ago

  • Status changed from Open to Feedback

I feel the idea is similar to #10445 (although not as dubious)

I'm curious as to when one would want to do this and actually get a Vector.

Updated by gogotanaka (Kazuki Tanaka) over 9 years ago

@Marc-Andre Lafortune

Thank for reply.

OK, I got your point. Actually I'm not sure anyone want to do this.

But I think there is no reason Vector[1,2,3][0..1] returns not Vector but Array.

thanks.

Updated by marcandre (Marc-Andre Lafortune) over 9 years ago

  • Status changed from Feedback to Rejected

gogo tanaka wrote:

But I think there is no reason Vector[1,2,3][0..1] returns not Vector but Array.

I agree completely, and don't I think it was intended. The doc states "Returns element number +i+" too.

Updated by gogotanaka (Kazuki Tanaka) over 9 years ago

@Marc-Andre Lafortune

OK, it does make sense. Thank you for your time.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0