Issue #6702 has been reported by rosenfeld (Rodrigo Rosenfeld Rosas). ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Open Priority: Low Assignee: 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.
on 2012-07-05 16:30
on 2012-07-05 17:10
Issue #6702 has been updated by mame (Yusuke Endoh). Status changed from Open to Assigned Assignee set to drbrain (Eric Hodel) Hello, This is caused by rubygems/specification: $ ruby -rrubygems/specification -e 'p Date; Date.today' Date -e:1:in `<main>': undefined method `today' for Date:Class (NoMethodError) See: https://github.com/rubygems/rubygems/blob/62653cb8... Eric, is this intentional? -- Yusuke Endoh <mame@tsg.ne.jp> ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-27830 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-07-05 17:24
Issue #6702 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). I've sent a pull request: https://github.com/rubygems/rubygems/pull/351 ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-27831 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-07-05 17:25
Issue #6702 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). By the way, what is the reason for Time being included by default but not Date? ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-27832 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-07-05 23:09
Issue #6702 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). Is Date that slow to require when compared to Time? Wouldn't it be possible to make it faster to load by lazy loading some parts and include it by default instead of having to require it manually? That would certainly make programmers happier ;) ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-27837 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-07-05 23:10
Issue #6702 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas). By the way, I forgot to say that that pull request was rejected. Please take a look at the link above for the reasoning behind it. ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-27838 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-07-06 00:36
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.
on 2012-07-06 05:11
Issue #6702 has been updated by nobu (Nobuyoshi Nakada). drbrain (Eric Hodel) wrote: > (As a trade-off, Date and DateTime give you a much larger range than a Time.) "Date and DateTime *had given* ..." In 1.9 or later, Time has arbitrary range and precision. ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-27842 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.
on 2012-12-05 12:45
Issue #6702 has been updated by kommen (Dieter Komendera). This is an issue again in Ruby 2.0.0 preview 2 as the require 'date' in rubygems/specification.rb as described in note 6 in this issue was removed again with this commit: https://github.com/rubygems/rubygems/commit/04422c... I found it to be a backward compatibility issue for example with the compass gem: https://github.com/chriseppstein/compass/blob/stab... Should this issue be reopened? ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-34409 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.
on 2012-12-05 13:31
Issue #6702 has been updated by mame (Yusuke Endoh). Status changed from Closed to Assigned Eric, what do you think? -- Yusuke Endoh <mame@tsg.ne.jp> ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-34411 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-12-05 18:23
Issue #6702 has been updated by drbrain (Eric Hodel). I don't know if I can solve this problem with RubyGems. Date is now a C extension. At ruby install time, Gem::Specification is loaded by rbinstall.rb which is run from miniruby. miniruby cannot load C extensions (as mentioned in the commit referenced above). I'll see if Date can be required only when needed. I believe rbinstall calls ruby_code which uses Date, so it may be difficult. ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-34430 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned 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.
on 2012-12-18 06:35
Issue #6702 has been updated by drbrain (Eric Hodel). Target version changed from 1.9.3 to next minor I am not clever enough to solve this problem. As I said before, tool/rbinstall.rb cannot load extensions. If I try to lazy-load Date in lib/rubygems/specification.rb tool/rbinstall.rb obviously, tool/rbinstall.rb fails. I cannot figure out how to only load Date when RubyGems was not loaded from mini ruby. Attempting to detect the LoadError results in an infinite loop. Perhaps someone more clever than I can fix this. I will leave it open for now. ---------------------------------------- Bug #6702: Date should be either required or not https://bugs.ruby-lang.org/issues/6702#change-34821 Author: rosenfeld (Rodrigo Rosenfeld Rosas) Status: Assigned Priority: Low Assignee: drbrain (Eric Hodel) Category: lib Target version: next minor 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.