On Sun, Aug 23, 2009 at 2:54 AM, Anton Vodonosovavodonosov@yandex.ru wrote:
Hello Alessio,
on Thursday, August 20, 2009, 12:45:44 PM Alessio wrote:
- ABCL is more suited to be embedded into J editor, than
into something else. For example Interpreter.kill method stops ABCL like:
if (jlisp) { ... close input output streams } else System.exit(status);
I.e. if we call Interpretter.kill() in IDEA plugin, it will exit whose IDEA process
Keep in mind that, in general, the ABCL interpreter is a singleton, and "killing" it is not that easy: besides open streams, other data is kept around so reverting the interpreter to a clean state is quite complicated.
I think if streams are closed, it will stop read-eval-print loop. There is a static method Interpreter.dispose() which assigns the static field "interpreter" to null. Therefore I hope everything will be garbage collected.
There is data in static fields too, and that won't be garbage collected. If some piece of this data holds reference to a symbol, which in turn references a package, which references other symbols, which can point to top-level variables, functions, CLOS classes, ... a whole lot of state will be kept alive. I'm not saying that the interpreter cannot be killed, just that eliminating all the garbage might not be easy. However such "garbage" might not pose problems in practice, I don't know.
Why are you trying to kill it in the first place?
Well, for example I want restart Lisp without closing IDEA. Or just to stop Lisp if I don't need it anymore.
It was only example of where ABCL is more suited for J editor than to anything else. Another example is method Interpreter.createJLispInstance. It accepts input/output streams.
For non J editor case, there is no factory method with input/output stream parameters.
There's a system function, system::top-level-loop IIRC, which implements the REPL and takes in and out streams as parameters; it might be what you want. (note that afaik closing the streams makes this function throw an exception).
But, as I said, it's a minor problem.
Maybe, but since embedding ABCL in Java applications is an important use case for ABCL, I think that we should make it as easy as possible: feel free to report any problem you have, however minor it is.
Cheers, Alessio