H
Hugh Sasse Staff Elec Eng
Reading about reflection, ObjectSpace will give you the objects in
your system, possibly selected by Class. Fine. It won't tell you
which variables are associated with them. You can trace on global
variables, you can look at instance variables, but how can you get
information about all variables? What *is* a variable, exactly, come
to that? It works like a sticky label so you can have two on the
same object, but are the variables themselve objects in ruby? Can I
twist ObjectSpace's arm to tell me about them?
Why have I run into this now?
I'm getting
#<TypeError: failed to convert nil into Array>
raised by a program where
rescue => e
p e, caller
gives some line numbers with an each keyword, where the code looks like
raise "@b1 is nil" if @b1.nil
@b1.each { |bf|
so I know that @b1 is not nil when it gets here. The each method is
one I wrote, so I'd expect it to blow up in there, with an
associated line number.
Can I get ruby to tell me all things that point at the one Nil
object in the universe, at the present time?
This is with 1.6.8 and with 1.8.0
Thank you,
Hugh
your system, possibly selected by Class. Fine. It won't tell you
which variables are associated with them. You can trace on global
variables, you can look at instance variables, but how can you get
information about all variables? What *is* a variable, exactly, come
to that? It works like a sticky label so you can have two on the
same object, but are the variables themselve objects in ruby? Can I
twist ObjectSpace's arm to tell me about them?
Why have I run into this now?
I'm getting
#<TypeError: failed to convert nil into Array>
raised by a program where
rescue => e
p e, caller
gives some line numbers with an each keyword, where the code looks like
raise "@b1 is nil" if @b1.nil
@b1.each { |bf|
so I know that @b1 is not nil when it gets here. The each method is
one I wrote, so I'd expect it to blow up in there, with an
associated line number.
Can I get ruby to tell me all things that point at the one Nil
object in the universe, at the present time?
This is with 1.6.8 and with 1.8.0
Thank you,
Hugh