Rubyists: stop using ObjectSpace._id2ref! It's not even safe to use on MRI/CRuby because it tries to reconstitute objects based on a pointer address in the GC heap (obj.object_id). JRuby does not support it out of the box.
-
-
Yeah, and having an object with its own identity and an attribute of that object that is sort of an "detachable" identity makes no sense for me.
-
That's how JRuby does it, lazily throw the next object_id into a hidden field. It's gross and makes every object from which you've retrieved an ID slower and bigger.
- 10 more replies
New conversation -
-
-
There's a reason VMs with modern GCs don't provide a built-in way to uniquely identify every object ever created
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
I don’t know how much it’s used internally, tbh, but if it were a memoized, lazily autoincrementing int, it wouldn’t have to be for every object ever created, just for ones that get the method called.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.