[ruby-dev:24211] Re: [SEGV] redefine Struct with same name

From: "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Date: 2004-09-03 07:52:10 UTC
List: ruby-dev #24211
山本です。

また、同じく二重定義のようでも、

  class Point
    def initialize(x,y)
      @x, @y = x, y
    end
  end
  p1 = Point.new(2, 3)
  p p1

  class Point
    def initialize(size)
      @size = size
    end
  end
  p2 = Point.new(200)
  p p2

  p p1

は SEGV しません。

  E:\>ruby c.rb
  #<Point:0x2b5c260 @y=3, @x=2>
  #<Point:0x2b5be40 @size=200>
  #<Point:0x2b5c260 @y=3, @x=2>



In This Thread