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

yarv-dev:1063

From: sheepman <sheepman sheepman.sakura.ne.jp>
Date: Fri, 21 Jul 2006 00:05:14 +0900
Subject: [yarv-dev:1063] open> private setter

こんばんは、sheepman です。

private な setter の振る舞いが ruby-1.8 や ruby-1.9 と
違うようです。

$ cat t.rb
class C
  private
  def hoge=(a)
  end

  public
  def foo
    self.hoge = 1
  end
end

p C.new.foo

$ ruby-2.0 -v t.rb
ruby 2.0.0 (Base: Ruby 1.9.0 2006-04-08) [i686-linux]
YARVCore 0.4.1 Rev: 525 (2006-07-18) [opts: [direct threaded code] [inline method cache] ]
t.rb:8:in `foo': private method `hoge=' called for #<C:0x40295f00> (NoMethodError)
        from t.rb:12:in `<main>'

$ ruby-1.9 -v t.rb
ruby 1.9.0 (2006-07-19) [i686-linux]
1

$ ruby-1.8 -v t.rb
ruby 1.8.4 (2006-05-18) [i686-linux]
1

-- 
sheepman / TAMURA Takashi
sheepman sheepman.sakura.ne.jp 

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

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

->    1063 2006-07-21 00:05 [sheepman sheepman.sa] open> private setter                    
      1086 2006-08-18 21:13 ┗[ko1 atdot.net       ]