[前][次][番号順一覧][スレッド一覧]

ruby-changes:26922

From: eregon <ko1@a...>
Date: Tue, 29 Jan 2013 19:32:38 +0900 (JST)
Subject: [ruby-changes:26922] eregon:r38974 (trunk): * array.c: Improve documentation about

eregon	2013-01-29 19:32:27 +0900 (Tue, 29 Jan 2013)

  New Revision: 38974

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38974

  Log:
    * array.c: Improve documentation about
      comparison by hash for concerned methods. [ruby-core:51266]

  Modified files:
    trunk/ChangeLog
    trunk/array.c

Index: array.c
===================================================================
--- array.c	(revision 38973)
+++ array.c	(revision 38974)
@@ -3800,7 +3800,7 @@ ary_recycle_hash(VALUE hash) https://github.com/ruby/ruby/blob/trunk/array.c#L3800
  *  Returns a new array that is a copy of the original array, removing any
  *  items that also appear in +other_ary+.
  *
- *  It compares elements using their hash (returned by the Object#hash method).
+ *  It compares elements using their #hash and #eql? methods for efficiency.
  *
  *     [ 1, 1, 2, 2, 3, 3, 4, 5 ] - [ 1, 2, 4 ]  #=>  [ 3, 3, 5 ]
  *
@@ -3832,6 +3832,8 @@ rb_ary_diff(VALUE ary1, VALUE ary2) https://github.com/ruby/ruby/blob/trunk/array.c#L3832
  *  Set Intersection --- Returns a new array containing elements common to the
  *  two arrays, excluding any duplicates.
  *
+ *  It compares elements using their #hash and #eql? methods for efficiency.
+ *
  *     [ 1, 1, 3, 5 ] & [ 1, 2, 3 ]                 #=> [ 1, 3 ]
  *     [ 'a', 'b', 'b', 'z' ] & [ 'a', 'b', 'c' ]   #=> [ 'a', 'b' ]
  *
@@ -3872,6 +3874,8 @@ rb_ary_and(VALUE ary1, VALUE ary2) https://github.com/ruby/ruby/blob/trunk/array.c#L3874
  *  Set Union --- Returns a new array by joining +ary+ with +other_ary+,
  *  excluding any duplicates.
  *
+ *  It compares elements using their #hash and #eql? methods for efficiency.
+ *
  *     [ "a", "b", "c" ] | [ "c", "d", "a" ]    #=> [ "a", "b", "c", "d" ]
  *
  *  See also Array#uniq.
@@ -3921,6 +3925,8 @@ push_value(st_data_t key, st_data_t val, https://github.com/ruby/ruby/blob/trunk/array.c#L3925
  *  If a block is given, it will use the return value of the block for
  *  comparison.
  *
+ *  It compares values using their #hash and #eql? methods for efficiency.
+ *
  *  Returns +nil+ if no changes are made (that is, no duplicates are found).
  *
  *     a = [ "a", "a", "b", "b", "c" ]
@@ -3983,8 +3989,7 @@ rb_ary_uniq_bang(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L3989
  *
  *  If a block is given, it will use the return value of the block for comparison.
  *
- *  It compares elements using their hash (provided by the Object#hash method)
- *  then compares hashes with Object#eql?.
+ *  It compares values using their #hash and #eql? methods for efficiency.
  *
  *     a = [ "a", "a", "b", "b", "c" ]
  *     a.uniq   # => ["a", "b", "c"]
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38973)
+++ ChangeLog	(revision 38974)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jan 29 19:27:18 2013  Benoit Daloze  <eregontp@g...>
+
+	* array.c: Improve documentation about
+	  comparison by hash for concerned methods. [ruby-core:51266]
+
 Tue Jan 29 17:03:28 2013  Koichi Sasada  <ko1@a...>
 
 	* vm_backtrace.c: fix issue of rb_debug_inspector_open().

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]