[#78949] [Ruby trunk Feature#13095] [PATCH] io.c (rb_f_syscall): remove deprecation notice — kosaki.motohiro@...
Issue #13095 has been updated by Motohiro KOSAKI.
3 messages
2017/01/03
[#78997] [Ruby trunk Bug#13110] Byte-based operations for String — shugo@...
Issue #13110 has been updated by Shugo Maeda.
3 messages
2017/01/06
[#79228] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150] — Eric Wong <normalperson@...>
naruse@ruby-lang.org wrote:
5 messages
2017/01/23
[#79511] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150]
— Eric Wong <normalperson@...>
2017/02/13
Eric Wong <normalperson@yhbt.net> wrote:
[#79518] Re: [ruby-cvs:64576] naruse:r57410 (trunk): Prevent GC by volatile [Bug #13150]
— Nobuyoshi Nakada <nobu@...>
2017/02/13
On 2017/02/13 10:04, Eric Wong wrote:
[#79298] [Ruby trunk Bug#13085][Assigned] io.c io_fwrite creates garbage — nobu@...
Issue #13085 has been updated by Nobuyoshi Nakada.
3 messages
2017/01/29
[#79337] Re: [ruby-changes:45397] normal:r57469 (trunk): io.c: recycle garbage on write — SASADA Koichi <ko1@...>
Eric:
4 messages
2017/01/31
[#79352] Re: [ruby-changes:45397] normal:r57469 (trunk): io.c: recycle garbage on write
— Eric Wong <normalperson@...>
2017/01/31
SASADA Koichi <ko1@atdot.net> wrote:
[ruby-core:79272] [Ruby trunk Bug#13102] Confusing method name: Set#delete?
From:
mail@...
Date:
2017-01-26 17:39:47 UTC
List:
ruby-core #79272
Issue #13102 has been updated by Stefan Schテシテ殕er. Kai Kuchenbecker wrote: > I think it is very surprising for a method ending in a question mark to have a side effect. Indeed, that also applies to `Set#add?`. > It is the more dangerous version of `Set#delete` so, I'm pretty sure it should have a bang. Not really, `Set#delete` also modifies the receiver. The actual difference is that `Set#delete` always returns `self`, whereas `Set#delete?` only returns `self` if the element existed in the set, and `nil` otherwise. > Exactly, it is the duality we all know from methods such as [...] Not quite. If a class has a method with and without `!` (e.g. `uniq` / `uniq!`), then the bang-method usually modifies the receiver (often returning `nil` to indicate "no changes") and and the non-bang method returns a new object. If we had both, `Set#delete` and `Set#delete!`, I would expect the non-bang method to return a new set and the band method to modify the receiver. That would be consistent but it would also break backwards compatibility. ---------------------------------------- Bug #13102: Confusing method name: Set#delete? https://bugs.ruby-lang.org/issues/13102#change-62689 * Author: Kai Kuchenbecker * Status: Open * 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: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>