From: noreply@... Date: 2007-05-30T11:44:33+09:00 Subject: [ ruby-Bugs-6413 ] Some Time Constructors Fail to Call initialize Bugs item #6413, was opened at 2006-10-31 13:44 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=6413&group_id=426 Category: Language / Runtime / Core Libraries Group: 1.8.x Status: Open Resolution: Rejected Priority: 3 Submitted By: David Wheeler (theory) Assigned to: Shyouhei Urabe (shyouhei) Summary: Some Time Constructors Fail to Call initialize Initial Comment: Some of the Time class constructor methods fail to call the initialize method in a subclass. For example, for this simple subclass: class MyTime < Time def initialize puts "Hello world!" end end When I test it with the constructor methods, none of these outputs the print statement: * at * parse * httpdate * rfc2822 * rfc822 * local ---------------------------------------------------------------------- >Comment By: Shyouhei Urabe (shyouhei) Date: 2007-05-30 11:44 Message: Subclassing is one thing, calling #initialize is another. Subclassing is allowed since 1.8.6 (to fix [#6400]), and #initialize is still not called. Object initialization is not always done by #initialize. ---------------------------------------------------------------------- Comment By: Ryan Davis (zenspider) Date: 2007-05-30 11:00 Message: I couldn't find matz's rejection on the ruby-core archives on blade. I found this: http://marc.info/?l=ruby-core&m=116228212521416&w=1 which says it was accepted and fixed. It doesn't appear to be so: >> MyTime.parse("2007-01-02").class => Time So... _should_ this be rejected? I don't think there is a good reason not to allow Time to be subclassed. It is immutable which makes it a little special, but I don't see that affecting subclassing. ---------------------------------------------------------------------- Comment By: David Wheeler (theory) Date: 2007-05-30 08:47 Message: Hrm. The rejection makes subclassing problematic. May I ask why? Thanks! David ---------------------------------------------------------------------- Comment By: Shyouhei Urabe (shyouhei) Date: 2007-05-30 08:20 Message: rejected by matz: [ruby-core:9361] ---------------------------------------------------------------------- Comment By: Ryan Davis (zenspider) Date: 2006-11-02 16:11 Message: This almost entirely goes through time_new_internal. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=6413&group_id=426