[#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:79823] [Ruby trunk Feature#13259] Kernel#Date
From:
sawadatsuyoshi@...
Date:
2017-02-28 12:09:51 UTC
List:
ruby-core #79823
Issue #13259 has been updated by Tsuyoshi Sawada.
Marcus Stollsteimer wrote:
> Note also the ongoing discussion about the future of Date (#13072).
Thanks for the notification. I actually do think there should be a similar thing with `Time`, and if `Date` is supposed to become obsolete and be absorbed into `Time`, then `Kernel#Time` would be convenient:
```ruby
Time("23:55")
Time("foo", exception: nil)
```
----------------------------------------
Feature #13259: Kernel#Date
https://bugs.ruby-lang.org/issues/13259#change-63259
* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I often see a piece of code like this:
```ruby
require "date"
begin
Date.strptime(some_string, some_format)
rescue
nil
end
```
Since we now have (https://bugs.ruby-lang.org/issues/12732) `Kernel#Integer` with a parameter to avoid raising an error in case of an invalid string, I think that having a counterpart of it in `Date` would be convenient. I propose `Kernel#Date`, which works like `Date.strptime` except that it takes an optional keyword argument, and works as follows:
```ruby
Date("2017/02/02", "%Y/%m/%d", exception: nil) # => #<Date: 2017-02-02 ((2457787j,0s,0n),+0s,2299161j)>
Date("foo", exception: nil) # => nil
```
--
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>