[#79440] [Ruby trunk Bug#13188] Reinitialize Ruby VM. — shyouhei@...
Issue #13188 has been updated by Shyouhei Urabe.
6 messages
2017/02/06
[#79441] Re: [Ruby trunk Bug#13188] Reinitialize Ruby VM.
— SASADA Koichi <ko1@...>
2017/02/06
On 2017/02/06 10:10, shyouhei@ruby-lang.org wrote:
[#79532] Immutable Strings vs Symbols — Daniel Ferreira <subtileos@...>
Hi,
15 messages
2017/02/15
[#79541] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/15
Em 15-02-2017 05:05, Daniel Ferreira escreveu:
[#79543] Re: Immutable Strings vs Symbols
— Daniel Ferreira <subtileos@...>
2017/02/16
Hi Rodrigo,
[#79560] Re: Immutable Strings vs Symbols
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2017/02/16
Em 15-02-2017 22:39, Daniel Ferreira escreveu:
[ruby-core:79572] [Ruby trunk Bug#13222] Array#sum inconsistency when init value is non-numeric
From:
ronnie@...
Date:
2017-02-17 10:59:28 UTC
List:
ruby-core #79572
Issue #13222 has been reported by Akira Matsuda.
----------------------------------------
Bug #13222: Array#sum inconsistency when init value is non-numeric
https://bugs.ruby-lang.org/issues/13222
* Author: Akira Matsuda
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.5.0dev (2017-02-17 trunk 57644) [x86_64-darwin15]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Since Array#sum skips calling plus for `0` https://github.com/ruby/ruby/blob/c85a58d/array.c#L5831-L5832, it doesn't raise when the receiver array consists of 0 only, even when the "init" value is non-numeric.
```
% ruby -e "p [1].sum('a')"
-e:1:in `sum': String can't be coerced into Integer (TypeError)
```
```
% ruby -e "p [0].sum('a')"
"a"
```
```
% ruby -e "p [0, 0, 0].sum('a')"
"a"
```
--
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>