From: Tim Hunter Date: 2002-10-21T08:52:13+09:00 Subject: rb_class_new_instance question ruby 1.6.7 (2002-03-01) [i686-linux] I have a class that is a subclass of Array: class MyClass < Array attr_accessor :scene def initialize @scene = nil end end This works fine when I create a new instance from Ruby code: m = MyClass.new p m.length -> 0 p m.scene -> nil However, if I create a new instance from C using rb_class_new_instance, the statement "@scene = nil" causes the length attribute to become a very large value. self.length may be 135674608, for example (but it's not necessarily the same from time to time). Everything else about the instance looks right. Under the debugger I can watch the call to MyClass#initialize from rb_class_new_instance. On entry, just prior to the "@scene = nil" statement, self.length is 0 as expected. Just after the statement it's bogus. Any ideas? What am I doing wrong? TIA!