ruby-changes:30212
From: knu <ko1@a...>
Date: Wed, 31 Jul 2013 14:58:31 +0900 (JST)
Subject: [ruby-changes:30212] knu:r42265 (trunk): * lib/set.rb: [DOC] Add a couple of notes on Hash as storage.
knu 2013-07-31 14:58:17 +0900 (Wed, 31 Jul 2013) New Revision: 42265 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42265 Log: * lib/set.rb: [DOC] Add a couple of notes on Hash as storage. Modified files: trunk/ChangeLog trunk/lib/set.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 42264) +++ ChangeLog (revision 42265) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Jul 31 14:41:36 2013 Akinori MUSHA <knu@i...> + + * lib/set.rb: [DOC] Add a couple of notes on Hash as storage. + Wed Jul 31 14:38:52 2013 Akinori MUSHA <knu@i...> * lib/set.rb: [DOC] Fix example result. Hash is now ordered. Index: lib/set.rb =================================================================== --- lib/set.rb (revision 42264) +++ lib/set.rb (revision 42265) @@ -27,14 +27,21 @@ https://github.com/ruby/ruby/blob/trunk/lib/set.rb#L27 # This is a hybrid of Array's intuitive inter-operation facilities and # Hash's fast lookup. # -# The equality of each couple of elements is determined according to -# Object#eql? and Object#hash, since Set uses Hash as storage. -# # Set is easy to use with Enumerable objects (implementing +each+). # Most of the initializer methods and binary operators accept generic # Enumerable objects besides sets and arrays. An Enumerable object # can be converted to Set using the +to_set+ method. # +# Set uses Hash as storage, so you must note the following points: +# +# * Equality of elements is determined according to Object#eql? and +# Object#hash. +# * Set assumes that the identity of each element does not change +# while it is stored. Modifying an element of a set will render the +# set to an unreliable state. +# * When a string is to be stored, a frozen copy of the string is +# stored instead unless the original string is already frozen. +# # == Comparison # # The comparison operators <, >, <= and >= are implemented as -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/