Issue #5185 has been updated by knu (Akinori MUSHA).

Status changed from Assigned to Rejected

On second thought recalling my original intention, I would say #update doesn't really fit for sets.

The word "update" indicates that some data may be lost through an operation by overwriting, but Set#merge does not cause any data loss (in terms of the equality definition in Set) whereas Hash#update does.  That's why I did not name it "update".

As for Set#merge, I admit it wasn't the best choice when we had Hash#merge, but you can always use the "|" operator to avoid confusion.  I'd also point out that there are not many examples where #merge is not destructive.  In fact, the majority works destuctively. (simple grepping in ruby's source tree and some other gems showed that)


I don't like Set#concat because the word concat[enate] usually means appending something at the bottom but Set has no sense of order.
I don't like Set#union! either because the word "union" is a noun, not a verb that a bang method is usually derived from.

----------------------------------------
Feature #5185: Set#merge acts in place but Hash#merge does not
https://bugs.ruby-lang.org/issues/5185#change-31894

Author: trans (Thomas Sawyer)
Status: Rejected
Priority: Normal
Assignee: knu (Akinori MUSHA)
Category: lib
Target version: 2.0.0


Waste of brain cells to have to learn and recall they are different. The expected method would be Set#merge!, Set#merge would return a new Set instance.

OTOH, why not Set#concat ? Or conversely, Array#merge ?




-- 
http://bugs.ruby-lang.org/