Why does Date exist in Ruby before it is required?
date, ruby
Solution
I believe that `date` doesn't come from `irb`, but from `rubygems`, specifically the file where `Gem::Specification` is defined:
class Date; end # for ruby_code if date.rb wasn't required
I believe they needed any `Date` class defined so that the interpreter doesn't complain further down in the `Specification` class.
Problem
In Ruby, I'd expect that a class which has not been required would raise an "uninitialized constant" error. This is the case with `CSV`, for instance. However, `Date` behaves strangely: it is available, but apparently does not work, until it is required. ``` ~: irb >> Date.new(2012,7,24) ArgumentError: wrong number of arguments(3 for 0) >> require 'date' => true >> Date.new(2012,7,24) => #<Date: 2012-07-24 ((2456133j,0s,0n),+0s,2299161j)> ``` What explains this behavior?