From: Txus Date: 2013-11-19T09:09:21+01:00 Subject: [ruby-core:58422] Re: [ruby-trunk - Feature #9123] Make Numeric#nonzero? behavior consistent with Numeric#zero? --047d7b33d548cb153504eb832ff8 Content-Type: text/plain; charset=UTF-8 Whereas the current implementation "works" as a predicate, I see no harm in gradually polishing Ruby towards a better design. If one was to design that from scratch, I bet there'd be no discussion -- predicates would return either true or false. I would love to see more of these kind of patches getting accepted. -- Txus (I'll be slowly moving off this address -- please contact me at me@txus.ioif possible from now on.) On Tue, Nov 19, 2013 at 2:32 AM, sferik (Erik Michaels-Ober) < sferik@gmail.com> wrote: > > Issue #9123 has been updated by sferik (Erik Michaels-Ober). > > > I did not remove that example, I just moved it under the documentation for > Numeric#nonzero. > ---------------------------------------- > Feature #9123: Make Numeric#nonzero? behavior consistent with Numeric#zero? > https://bugs.ruby-lang.org/issues/9123#change-43012 > > Author: sferik (Erik Michaels-Ober) > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > > > Numeric#zero? returns true or false, while Numeric#nonzero? returns self > or nil. > > I've written a patch that fixes this inconsistency and adds a > Numeric#nonzero (non-predicate) method that returns self or nil for > chaining comparisons. I'd like for this to be included in Ruby 2.1.0. > > https://github.com/ruby/ruby/pull/452.patch > > > -- > http://bugs.ruby-lang.org/ > --047d7b33d548cb153504eb832ff8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Whereas the current implementation "works" = as a predicate, I see no harm in gradually polishing Ruby towards a better = design. If one was to design that from scratch, I bet there'd be no dis= cussion -- predicates would return either true or false.

I would love to see more of these kind of patches getting accepte= d.

--
Txus
(I'll be slowly moving off this= address -- please contact me at me@txus.io if possible from now on.)


On Tue, Nov 19, 2013 at 2:32 AM, sferik = (Erik Michaels-Ober) <sferik@gmail.com> wrote:

Issue #9123 has been updated by sferik (Erik Michaels-Ober).


I did not remove that example, I just moved it under the documentation for = Numeric#nonzero.
----------------------------------------
Feature #9123: Make Numeric#nonzero? behavior consistent with Numeric#zero?=
https://bugs.ruby-lang.org/issues/9123#change-43012

Author: sferik (Erik Michaels-Ober)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:


Numeric#zero? returns true or false, while Numeric#nonzero? returns self or= nil.

I've written a patch that fixes this inconsistency and adds a Numeric#n= onzero (non-predicate) method that returns self or nil for chaining compari= sons. I'd like for this to be included in Ruby 2.1.0.

h= ttps://github.com/ruby/ruby/pull/452.patch


--
http://bugs.ruby-l= ang.org/

--047d7b33d548cb153504eb832ff8--