From: "Aleksi Niemelä" Date: 2000-12-16T06:31:01+09:00 Subject: [ruby-talk:7350] Re: Different id's for the Object meta clas s? John Small also commented me privately, but I noticed some errors in my assumptions, so I thought to correct at least them. > Thanks for taking the time to respond. No problem. These moments are opportunities -- to learn something new. > I was under the impression that VALUE is just an unsigned long. > I was assuming this unsigned long is the pointer to the object Your impression and assumption was right, mine was wrong. ruby.h states typedef unsigned long VALUE; typedef unsigned long ID; > ..and the same thing as Object#id returns. But here it differs. Please look to object.c, which has code which converts Ruby objects to IDs for basic types: rb_to_id(name) VALUE name; { ID id; switch (TYPE(name)) { case T_STRING: return rb_intern(RSTRING(name)->ptr); case T_FIXNUM: id = FIX2INT(name); if (!rb_id2name(id)) { rb_raise(rb_eArgError, "%d is not a symbol", id); } break; case T_SYMBOL: id = SYM2ID(name); break; default: rb_raise(rb_eTypeError, "%s is not a symbol", STR2CSTR(rb_inspect(name))); } return id; } - Aleksi