[RCR] Expose iv_get/iv_set to Ruby

I have a potential need to deal with all of the instance variables in
an object. (I say potential because I’m porting and the original code
does this. After I port this and refactor for Ruby, the need may go
away – but I don’t know.)

What I need to do is basically:

self.instance_variables.each do |key|
to_free << self.iv_get(key)
self.iv_set(key, nil)
end

Now, rb_iv_set/rb_iv_get aren’t visible from the Ruby side
(apparently), but they are visible from the C side. Are there good
reasons to not allow this, or can we modify it so that iv_get and
iv_set (or better names for them) are available as private methods to
go along with instance_variables?

-austin
– Austin Ziegler, austin@halostatue.ca on 2003.03.31 at 23:02:53

Hi,

···

At Tue, 1 Apr 2003 13:08:42 +0900, Austin Ziegler wrote:

Now, rb_iv_set/rb_iv_get aren’t visible from the Ruby side
(apparently), but they are visible from the C side. Are there good
reasons to not allow this, or can we modify it so that iv_get and
iv_set (or better names for them) are available as private methods to
go along with instance_variables?

Kernel#instance_variable_get and #instance_variable_set are
added in 1.8.


Nobu Nakada