[#81492] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — normalperson@...
Issue #13618 has been reported by normalperson (Eric Wong).
12 messages
2017/06/01
[#88695] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/08/27
> https://bugs.ruby-lang.org/issues/13618
[#81569] [Ruby trunk Feature#12589] VM performance improvement proposal — vmakarov@...
Issue #12589 has been updated by vmakarov (Vladimir Makarov).
3 messages
2017/06/04
[#81581] [Ruby trunk Bug#13632] Not processable interrupt queue for a thread after it's notified that FD is closed in some other thread. — sir.nickolas@...
Issue #13632 has been reported by nvashchenko (Nikolay Vashchenko).
4 messages
2017/06/05
[#81590] Re: [ruby-cvs:66197] ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures. — Eric Wong <normalperson@...>
ko1@ruby-lang.org wrote:
5 messages
2017/06/06
[#81591] Re: [ruby-cvs:66197] ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
— Eric Wong <normalperson@...>
2017/06/06
Eric Wong <normalperson@yhbt.net> wrote:
[#81596] Re: [ruby-cvs:66203] Re: Re: ko1:r59023 (trunk): revert r59020 because it may fail some tests sometimes on some environment (http://ci.rvm.jp/). This revert is to check the reason of failures.
— Eric Wong <normalperson@...>
2017/06/06
Eric Wong <normalperson@yhbt.net> wrote:
[#81825] [Ruby trunk Feature#13697] [PATCH]: futex based thread primitives — normalperson@...
Issue #13697 has been reported by normalperson (Eric Wong).
3 messages
2017/06/29
[ruby-core:81812] [Ruby trunk Feature#12968] Allow default value via block for Integer(), Float() and Rational()
From:
mail@...
Date:
2017-06-28 17:53:08 UTC
List:
ruby-core #81812
Issue #12968 has been updated by sos4nt (Stefan Schテシテ殕er).
shyouhei (Shyouhei Urabe) wrote:
> we would like to to merge this issue with #12732. How do you feel, Stefan?
I'm fine with with that.
----------------------------------------
Feature #12968: Allow default value via block for Integer(), Float() and Rational()
https://bugs.ruby-lang.org/issues/12968#change-65509
* Author: sos4nt (Stefan Schテシテ殕er)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
`Kernel` provides the global conversion functions `Integer()`, `Float()` and `Rational()`. Each one convert its argument to the respective type.
Parsing errors are signaled by raising a `TypeError` or an `ArgumentError`.
I often use these methods to parse numeric string values, but I find the need for a `rescue ArgumentError` block quite annoying an distracting.
I therefore request a new feature: `Integer()`, `Float()` and `Rational()` should take an _optional block_ that serves as a callback when parsing failed.
Examples:
```ruby
Integer('foo') #=> ArgumentError (just as before)
Integer('foo') { 0 } #=> 0 (same as 'foo'.to_i)
Integer('foo') { nil } #=> nil
Integer('foo') { Float::NAN } #=> NaN
```
This resembles the way `Hash#fetch` or `Hash#fetch_values` work when a block is given.
Although not used in the examples above, any arguments should be passed along to the block, i.e. `Integer('foo') { |arg, base| ... }`
--
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>