Project

General

Profile

Actions

Bug #7803

closed

RDoc documentation: `Array#&` clarification

Added by sawa (Tsuyoshi Sawada) almost 12 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
Target version:
ruby -v:
Backport:
[ruby-dev:46953]

Description

In the RDoc documentation for Array#&, it does not mention whether the order of the elements in the returned array preserves the order in the receiver. There is a question raised regarding this point in stackoverflow:

http://stackoverflow.com/questions/14764135/is-order-preserved-in-arrays-when-intersection-is-done

and it mentions that that is included in the test for RubySpec

https://github.com/rubyspec/rubyspec/blob/master/core/array/intersection_spec.rb#L16

so it looks like that is taken for granted, but it is not guaranteed. If it is indeed a feature, then that should be written in the document. If not, (meaning the order might not be preserved in a future implementation), then that should also be mentioned in the document as a warning. The documentation for Array#- makes that point clear:

Array Difference---Returns a new array that is a copy of the original array, removing any items that ...

so, perhaps the docmentation for Array#& should be written along the same line.

Updated by ko1 (Koichi Sasada) almost 12 years ago

  • Category set to doc
  • Assignee set to zzak (zzak _)
  • Target version set to 2.6

Updated by zzak (zzak _) over 11 years ago

  • Status changed from Open to Closed

Resolved by r39415

Updated by zzak (zzak _) over 11 years ago

  • % Done changed from 0 to 100
Actions #4

Updated by naruse (Yui NARUSE) over 11 years ago

  • Tracker changed from Misc to Bug
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0