Ken Bloom wrote: > ObjectSpace shouldn't go. > > Last time I saw this discussion, you mentioned that it wasn't a problem > (and was in fact important) to support > ObjectSpace.{define,add,call,undefine,remove}_finalizer, and how > ObjectSpace._id2ref is still supportable, and clearly > ObjectSpace.garbage_collect is identical to GC.start. And I saw people > getting very confused over this issue when you discussed it for JRuby. > > It's each_object that you want to get rid of, so say that instead. id2ref is just about as bad, since in order to support id2ref we have to stand up an extra reference to any object for which object_id has been called. The unfortunate thing is that lots of people use object_id for a general "id" for an object without realizing this is the case. ObjectSpace is also not necessary to define a finalizer; this is a side effect of MRI's memory model and GC and the fact that ObjectSpace is essentially just a set of heap-related APIs. It would be just as easy to provide Object#define_finalizer and have the same effect, or simply use the existance of a finalize method as the trigger. So ObjectSpace really could go away. - Charlie