[#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:79684] [Ruby trunk Feature#12602] Add NilClass#to_d
From:
Dendoh@...
Date:
2017-02-22 11:25:54 UTC
List:
ruby-core #79684
Issue #12602 has been updated by Chun-wei Kuo. File add-nil-to-d.patch added Hi, are there any updates or concerns about this feature? ---------------------------------------- Feature #12602: Add NilClass#to_d https://bugs.ruby-lang.org/issues/12602#change-63104 * Author: Chun-wei Kuo * Status: Assigned * Priority: Normal * Assignee: Kenta Murata * Target version: ---------------------------------------- `bigdecimal/util` adds a `#to_d` method to many native classes, as a shortcut to converting them to `BigDecimal`, e.g. ```ruby require 'bigdecimal' require 'bigdecimal/util' 1.23.to_d # => #<BigDecimal:7fa4f11f0958,'0.123E1',18(36)> ``` However, `#to_d` is not added to `NilClass`: ```ruby nil.to_d # => NoMethodError: undefined method `to_d' for nil:NilClass ``` While `to_i`, `to_f`, etc. works on `nil`: ```ruby nil.to_i # => 0 nil.to_f # => 0.0 ``` I think it is reasonable to make `to_d` behave more like its counterparts. Therefore, I tried implementing the `NilClass#to_d` method in `bigdecimal/util` with a test. The method always returns `0` in `BigDecimal`. Please see attached patch. Thanks! :) ---Files-------------------------------- add-nil-to-d.patch (1.34 KB) add-nil-to-d.patch (1.34 KB) -- 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>