Issue #6702 has been updated by drbrain (Eric Hodel).

Status changed from Assigned to Closed

The pull request was rejected due to its implementation.  For compatibility with old gems a Date class must be defined. I decided to switch to require 'date' since rubygems/specification.rb is lazily loaded now and the cost of loading it is low.  The commit to rubygems will be imported in the future so I will close this ticket.

Time is part of the core libraries with parsing and extra output formats defined in time.rb.  Date exists entirely outside of the core ruby classes so you must require it separately.

Historically Date was much slower than Time due to its implementation.  Today that gap is narrower, but Date is still slower than Time.  (As a trade-off, Date and DateTime give you a much larger range than a Time.)

Remember, you must require libraries you directly depend on.  Do not expect a dependency to load it for you indirectly.  This will only lead to bugs and incompatibility as your dependencies change.
----------------------------------------
Bug #6702: Date should be either required or not
https://bugs.ruby-lang.org/issues/6702#change-27841

Author: rosenfeld (Rodrigo Rosenfeld Rosas)
Status: Closed
Priority: Low
Assignee: drbrain (Eric Hodel)
Category: lib
Target version: 1.9.3
ruby -v: ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]


Today I was trying to do some experiment with IRB: "Date.today" threw a NoMethodError.

But Date was defined: "defined? Date" == "constant".

If I explicitly required for "date" it worked, but this is pretty much weird. It would be better if either:

 - I got an undefined "Date" class instead
 - "date" was automatically required

The current state is pretty much misleading.

This also happens in JRuby, so I guess somehow this is an intended behavior, but it doesn't make any sense to me.


-- 
http://bugs.ruby-lang.org/