Re: Id question

From: matz@... (Yukihiro Matsumoto)
Date: 2002-10-04 09:04:12 UTC
List: ruby-core #525
Hi,

In message "Re: Id question"
    on 02/10/04, Torsten Rer <torsten.rueger@firsthop.com> writes:

|Can I just call rb_define_attr(klass, name, read, write) to define 
|"__purple__id" for all classes except immediate types ?

rb_define_attr() just defines access methods ("name" and "name="), so
you don't have to exclude immediate types.

|What call can I use to find if "__purple__id" is already defined ?

defined? in Ruby program, rb_obj_respond_to() in C program.

|What call do I use to set the "__purple__id" on an object, I don't find 
|the appropriate if I know the function (even id) and know it takes only 
|one argument ?

  rb_funcall(obj, rb_intern("__purple__id="), 1, val)

							matz.

In This Thread

Prev Next