Feature #14274
openMerge Std-Lib Time Class into Core
Description
Please excuse me if this is a duplicate or already asked-and-answered. I won't be offended by an automatic close.
I personally find it confusing when to use the Core version of the Time
class versus the Std-Lib require "time"
version of Time
. I fail to see what makes the Std-Lib version of that class so differentiable from Core to necessitate an explicit require statement. Merging these two into one Core version would cut some amount of complexity in using the Ruby language, however small a complexity it may be, to improve user experience by automatically having all methods in Time
available.
As an example of this complexity in action, I was recently working on a Rails app stack today alongside another experienced Ruby developer like myself. We switched over from working on code in the Rails app to working on code in a supporting nested gem. This gem does not have a dependency on Rails, so it does not pull in the monkey-patched Rails version of Time
. Thus, when we wanted to write a function that uses Time.parse
, we ran into an issue with the Ruby interpreter not recognizing this method. We were initially confused about how this could be happening, for a moment positing that this parse
method is unique to Rails. Eventually, we realized that we needed to add require "time"
to the codebase, although it took a bit of Googling to realize that there were two different versions of the Time
class in the Ruby language. Even though this complexity was small and the fix trivial, we lost 5-10 minutes of productivity to it. We are experienced developers, so imagine the pain that a newer developer with little knowledge of the difference between Core and Std-Lib would suffer.
Hopefully you can see the reasoning that I am applying to this request. I am happy to divulge deeper into the problem if necessary. If you agree, then hopefully this can make it into the next minor version of Ruby. Thank you. :D