Please ignore my previous post on CallFrames - I've solved that
particular problem. But now I have a new one. How can I check whether an
interpreter is still valid - i.e. that it hasn't been deleted? In some
code, I store a reference to an Interp object. At some later stage, I
need to evaluate some Tcl code in the interpreter. I need first, though,
to check that the reference I have is still valid. If it isn't then I
can clean up my code and throw an exception. However, there doesn't seem
to be any way to tell if an Interp object is still valid. I noticed in
the sources that there is a "deleted" flag in the Interp object, which
is set when the interpreter is disposed. Could a isValid() method be
added to the Interp object to check this flag? Something along the lines
of:
public boolean isValid() {
return deleted;
}
would do the trick. Is this a bad idea, or is there another way to do
this? If there are no objections, could this be added?
Cheers,
Neil Madden.
PS - I notice that a lot of the code in the Jacl source imports whole
packages, but only uses some of the classes in that package (e.g.
java.util.*, java.io.* etc). Does this load all the classes of that
package into the virtual machine, or does it wait until they are
actually used? I'm a bit sketchy on this point. If the former, then
could a script be written to traverse the source and replace these with
imports of only the classes that were actually used, to save some
startup time, and memory usage? The script could have a threshold so
that if more than x classes from a package were imported, then do an
'import package.*', to prevent massive lists of imports at the top of
source files. Another alternative would be to use fully qualified names
in the code, and get load-on-demand, but this would make the source a
bit unreadable. Any thoughts?
|