Project

General

Profile

Feature #17022

Updated by sawa (Tsuyoshi Sawada) 2 months ago

What if we have a method `Kernel#Date` that delegates to `Date.parse`? 

 Dates could be written in a more natural way, right? 

 ```ruby 
 Date("2020-01-13") - Date("2019-01-13") 
 ``` 

 Capitalized Another capitalized methods are defined on added to the `Kernel` Kernel module to facilitate construction of another basic types: 


 ``` ruby 
 Kernel.methods.grep(/^[A-Z].*/) 
 #=> [:Rational, :Complex, :URI, :Integer, :Float, :String, :Array, :Hash, :Pathname] 
 ``` 

 Method `BigDecimal` is added too when the corresponding library is required: 

 ```ruby 
 require 'bigdecimal' 
 Kernel.methods.grep(/^[A-Z].*/) 
 #=> [:Rational, :Complex, :BigDecimal, :URI, :Integer, :Float, :String, :Array, :Hash, :Pathname] 
 ``` 

 The So the proposal is to do the same; same was done with BigDecimal, when we do `require 'date'`, 'date'` a method `Kernel#Date` should be added. added as well.

Back