[前][次][番号順一覧][スレッド一覧][生データ]

yarv-dev:1080

From: SASADA Koichi <ko1 atdot.net>
Date: Thu, 17 Aug 2006 11:35:30 +0900
Subject: [yarv-dev:1080] fixed> Re: open>Float#==(other) don't call other.==

 ささだです.

 コード中で typo してました.直しました.

Ken Date wrote:
> 伊達です。
> 
> Float オブジェクトと他のオブジェクトを比較したときの振る舞いが、1.8/1.9
> とは異なります。
> 1.8/1.9 では Float#==(other) で other.== が呼ばれているようです。
> coerce 絡みの挙動なのでしょうか。
> 
> $ ruby-yarv -v -e '
> class Foo
>  def ==(other)
>    true
>  end
> end
> f = Foo.new
> p 1.0 == f
> p f == 1.0
> p 1 == f
> p f == 1
> '
> ruby 2.0.0 (Base: Ruby 1.9.0 2006-04-08) [i686-linux]
> YARVCore 0.4.1 Rev: 527 (2006-07-19) [opts: [direct threaded code]
> [inline method cache] ]
> false
> true
> true
> true
> 
> $ ruby18 -v -e '
> class Foo
>  def ==(other)
>    true
>  end
> end
> f = Foo.new
> p 1.0 == f
> p f == 1.0
> p 1 == f
> p f == 1
> '
> ruby 1.8.4 (2005-12-24) [i686-linux]
> true
> true
> true
> true
> 
> $ ruby19 -v -e '
> class Foo
>  def ==(other)
>    true
>  end
> end
> f = Foo.new
> p 1.0 == f
> p f == 1.0
> p 1 == f
> p f == 1
> '
> ruby 1.9.0 (2006-07-21) [i686-linux]
> true
> true
> true
> true
> 
> -- 
> ML: yarv-dev quickml.atdot.net
> Info: http://www.atdot.net/~ko1/quickml


-- 
// SASADA Koichi at atdot dot net



--
ML: yarv-dev quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧][生データ]

      1072 2006-07-29 11:14 [itacchi gmail.com   ] open>Float#==(other) don't call other.==
->    1080 2006-08-17 11:35 ┗[ko1 atdot.net       ] fixed> Re: open>Float#==(other) don't call other.==