[#86520] [Ruby trunk Bug#14681] `syswrite': stream closed in another thread (IOError) — samuel@...
Issue #14681 has been reported by ioquatix (Samuel Williams).
3 messages
2018/04/12
[#86755] [Ruby trunk Feature#14723] [WIP] sleepy GC — normalperson@...
Issue #14723 has been reported by normalperson (Eric Wong).
6 messages
2018/04/29
[ruby-core:86514] [Ruby trunk Feature#14672] Introdice a Date.safe_parse method
From:
pdahorek@...
Date:
2018-04-11 15:56:35 UTC
List:
ruby-core #86514
Issue #14672 has been updated by ahorek (Pavel Rosick箪).
http://blog.honeybadger.io/benchmarking-exceptions-in-ruby-yep-theyre-slow
exceptions are used a lot in parsers
https://github.com/ruby/csv/blob/master/lib/csv.rb#L342
having an oportunity to skip exception handing could also improve performance
I prefer an argument version, btw. sockets already have simmilar logic since ruby 2.3
```ruby
@socket.connect_nonblock(@addr, exception: false)
```
example
```ruby
Date.parse(some_value, exception: false) || Date.new(2018,1,1)
```
----------------------------------------
Feature #14672: Introdice a Date.safe_parse method
https://bugs.ruby-lang.org/issues/14672#change-71455
* Author: coorasse (Alessandro Rodi)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
This feature request is about a Date.safe_parse method.
The method should call the original Date.parse method but avoid raising an exception and returning a fallback value instead.
An implementation in ActiveSupport has been proposed here: https://github.com/rails/rails/pull/32503/files.
This would avoid the necessity to rescue possible Exceptions everytime.
See:
```ruby
Date.safe_parse(nil)
=> # nil
Date.safe_parse("")
=> # nil
fallback = Date.new(2018,1,1)
Date.safe_parse(nil, fallback)
=> # #<Date: 2018-01-01>
```
--
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>