[MacRuby] #854: Time and NSDate cannot be compared with Comparable operators
#854: Time and NSDate cannot be compared with Comparable operators ----------------------------------+----------------------------------------- Reporter: massicotte@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Time is now relatively equivalent to NSDate, but they cannot be compared with the Comparable operators. If compare: works, <=> should be implemented as well. $ macirb irb(main):001:0> date = NSDate.date => #<__NSCFDate:0x20023d3a0> irb(main):002:0> time = Time.now => 2010-08-17 16:28:46 -0700 irb(main):003:0> time < date ArgumentError: comparison of Time with __NSCFDate failed irb(main):005:0> date.compare(time) => -1 irb(main):006:0> time.compare(date) => 1 irb(main):007:0> -- Ticket URL: <http://www.macruby.org/trac/ticket/854> MacRuby <http://macruby.org/>
#854: Time and NSDate cannot be compared with Comparable operators ----------------------------------+----------------------------------------- Reporter: massicotte@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Description changed by martinlagardette@…: Old description:
Time is now relatively equivalent to NSDate, but they cannot be compared with the Comparable operators. If compare: works, <=> should be implemented as well.
$ macirb irb(main):001:0> date = NSDate.date => #<__NSCFDate:0x20023d3a0> irb(main):002:0> time = Time.now => 2010-08-17 16:28:46 -0700 irb(main):003:0> time < date ArgumentError: comparison of Time with __NSCFDate failed
irb(main):005:0> date.compare(time) => -1 irb(main):006:0> time.compare(date) => 1 irb(main):007:0>
New description: Time is now relatively equivalent to NSDate, but they cannot be compared with the Comparable operators. If compare: works, <=> should be implemented as well. {{{ $ macirb irb(main):001:0> date = NSDate.date => #<__NSCFDate:0x20023d3a0> irb(main):002:0> time = Time.now => 2010-08-17 16:28:46 -0700 irb(main):003:0> time < date ArgumentError: comparison of Time with __NSCFDate failed irb(main):005:0> date.compare(time) => -1 irb(main):006:0> time.compare(date) => 1 irb(main):007:0> }}} -- -- Ticket URL: <http://www.macruby.org/trac/ticket/854#comment:2> MacRuby <http://macruby.org/>
#854: Time and NSDate cannot be compared with Comparable operators ----------------------------------+----------------------------------------- Reporter: massicotte@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * milestone: => MacRuby 1.0 Comment: Looks like a good candidate for 1.0. -- Ticket URL: <http://www.macruby.org/trac/ticket/854#comment:3> MacRuby <http://macruby.org/>
#854: Time and NSDate cannot be compared with Comparable operators ----------------------------------+----------------------------------------- Reporter: massicotte@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby 1.0 Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Comment(by pthomson@…): Works for me as of r5123. Can anyone else confirm this? -- Ticket URL: <http://www.macruby.org/trac/ticket/854#comment:4> MacRuby <http://macruby.org/>
#854: Time and NSDate cannot be compared with Comparable operators ----------------------------------+----------------------------------------- Reporter: massicotte@… | Owner: lsansonetti@… Type: defect | Status: new Priority: minor | Milestone: MacRuby Later Component: MacRuby | Keywords: ----------------------------------+----------------------------------------- Changes (by lsansonetti@…): * milestone: MacRuby 1.0 => MacRuby Later Comment: It works for you because you were probably running on the bleeding edge, where NSDates are immediates, so automatically converted to Time objects. Well I guess this radar can go to Later then. -- Ticket URL: <http://www.macruby.org/trac/ticket/854#comment:5> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby