M. Edward (Ed) Borasky said:
Let me re-phrase that ... how do I know when I'm coding that I'm not
going to ask for it? Do I need to explicitly call/require/include
something to get it?
Well, you need to explicitly reference ObjectSpace in most cases to
access it, right?
In general, the tricky bit is that there's at least one key library in
stdlib that depends on ObjectSpace: test/unit, which uses it to locate
tests. However I've implemented in JRuby the ability to walk all child
classes from a parent class, which provides the each_object(Class) used
in test/unit. Currently, you can turn off ObjectSpace support in JRuby
and still have test/unit run.
Raising an error might be a better way to ensure people don't run code
without ObjectSpace enabled, certainly. But maybe they don't care?
It's an open question at the moment, but I don't see that there's any
way ObjectSpace is going to have good performance on these new
implementations where we don't have intimate control over memory and GC.
I expect this is going to be a concern for IronRuby/Ruby.NET too. As far
as I know, JRuby's the only general-purpose VM implementation of Ruby
that's even *attempted* to make ObjectSpace work.