From: merch-redmine@... Date: 2019-08-24T03:27:52+00:00 Subject: [ruby-core:94523] [Ruby master Bug#13102] Confusing method name: Set#delete? Issue #13102 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected I don't think this is a bug, I believe it is intentional. Using `?` for mutating methods is uncommon, but not wrong. You can use these like predicate methods, which is probably why they end in `?`: ```ruby if set.delete?(object) # object was in the set and deleted else # object was not in the set end ``` ---------------------------------------- Bug #13102: Confusing method name: Set#delete? https://bugs.ruby-lang.org/issues/13102#change-80964 * Author: kaikuchn (Kai Kuchenbecker) * Status: Rejected * Priority: Normal * Assignee: * Target version: * ruby -v: 2.4.0 * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Greetings, a colleague of mine who recently started to learn Ruby managed to greatly confuse me today when he used Set#delete? which he claimed would delete an item from a set. Reading the documentation I suspect the method was meant to be named delete! as it behaves similiar to Array#uniq! and such methods. If this is not a mistake, I'd still suggest to change the method name since I think it is very surprising for a method ending in a question mark to have a side effect. Best regards, Kai -- https://bugs.ruby-lang.org/ Unsubscribe: