[Ironruby-core] Core Review: Time and IO#open fixes

Tomas Matousek Tomas.Matousek at microsoft.com
Sun Aug 23 17:58:56 EDT 2009


What are overloads like this:
...(int second, int minute, int hour, int day, int month, int year,  object wday, object yday, object isdst, object zone)
good for?

It seems that the parameters typed to object are not used. Also when you cast double to int it might overflow. What should happen if a big integer is passed in?

This is also suspicious:

public static DateTime Create(object/*!*/ self, long seconds, long microseconds)

MRI actually uses a default protocol for Fixnum for the parameters:

class C
  def respond_to? name
    puts name
    true
  end

  def to_int
   123
  end
end

Time.at(C.new, 1.2)                  #=> to_int
Time.at(C.new, 1000000000) #=> to_int

Tomas


-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Daniele Alessandri
Sent: Sunday, August 23, 2009 1:20 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Core Review: Time and IO#open fixes

On Sun, Aug 23, 2009 at 15:15, Daniele Alessandri<suppakilla at gmail.com> wrote:

[...]
> * http://github.com/nrk/ironruby/commit/48a4a02b5b47d61f2f7a3f3887ea4bf02d63edb4
> Miscellaneous fixes to Time:
[...]

Just noticed the wrong link :-/ Here is the correct one:
http://github.com/nrk/ironruby/commit/fb55ffcfb7193eba537eb4aba98c3d55871006d6

--
Daniele Alessandri
http://www.clorophilla.net/blog/
http://twitter.com/JoL1hAHN
_______________________________________________
Ironruby-core mailing list
Ironruby-core at rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core



More information about the Ironruby-core mailing list