From: nobu.nokada@... Date: 2002-01-04T16:58:35+09:00 Subject: [ruby-talk:30185] Re: How to get top-level object from C? At Fri, 4 Jan 2002 16:26:10 +0900, ts wrote: > n> Sorry, I was wrong and correct it. > > No, you were right except for top-level method which are not really module > functions Sure, I missed that Object itself is also an instance of Object. Thanx. > n> variables. It's possible to access the main with > n> ruby_top_self, however, it needs a declaration now. > > rb_cObject can access methods but not an instance variable defined (for > example) in uu.rb Then, is it OK as the answer to Paul's [ruby-talk:30124]? Since top-level methods are private instance methods of Object, any object can access to the methods, but not to top-level instance variables. Therefore a method using the instance variables may not work properly. It's possible to access the top-level object with ruby_top_self, however, it needs a declaration now. BTW, do you consider it should be declared in ruby.h? -- Nobu Nakada