[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[ruby-core:78801] [Ruby trunk Feature#12902] How about Enumerable#sum uses initial value rather than 0 as default?
From:
samuel@...
Date:
2016-12-22 01:40:53 UTC
List:
ruby-core #78801
Issue #12902 has been updated by Samuel Williams.
Just to add, this breaks code which uses facets.
https://github.com/rubyworks/facets/issues/247
The method signature is:
def sum(*identity, &block)
I think it's probably important to consider this use case.
----------------------------------------
Feature #12902: How about Enumerable#sum uses initial value rather than 0 as default?
https://bugs.ruby-lang.org/issues/12902#change-62206
* Author: Aaron Lasseigne
* Status: Rejected
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
In https://bugs.ruby-lang.org/issues/12217#note-3, Akira Tanaka, mentions that the default argument to sum is 0. This creates problems with non-numeric summations (e.g. strings). This would make the method more flexible. It also makes it behave more like `reduce`. I think using the initial value in the enumerable is less surprising than using 0.
--
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>