Luke Gorrie luke@synap.se writes:
Antonio Menezes Leitao aml@gia.ist.utl.pt writes:
I made a quick hack that allows the Slime listener to use Lisp objects that were returned from the Common Lisp environment.
Very nice :-)
Now, it should be obvious that I am keeping all the returned values in the Common Lisp side for further use. This means that they are not GCed. So, from time to time, it might be wise to clean the Listener (just like before, with C-cC-t) or just the previous output (with C-cC-o). This also releases the corresponding objects from the Common Lisp side.
I added a swank:*record-repl-results* variable so that people can turn this off if they want to. I'm a little worried about the potential for astonishment ("why isn't GC working?!") but not sure what the best solution is.
Tell people that everything that is visible on the screen is still reachable? Now, our eyes are part of the Common Lisp environment :-)
If the Slime team thinks this is useful then I suggest that you take a good look at the code (as you usually do :-) and refactor it radically because I did a lot of copy&paste just to test the idea. And it might also contains lots of bugs :-)
I get it: generate some code and then let the Emacs-monkeys worry about maintaining it. :-) ...
That was not my idea. I'll help maintaining it, obviously, but during its development I noticed that I was doing lots of things that I knew a Slime expert (and not an Emacs-monkey) would do much better. Just as an example, I'm reusing the continuation id to mark the saved result. I'm not sure this is the best solution. Also, this id is made available from the 'eval-for-emacs' function to the listener-eval function using a dynamic variable and this doesn't look very nice. The same problem happens in the Emacs side, where I left a comment:
(let ((slime-current-output-id id)) ;; this is not very ;; elegant but it avoids changing the protocol
Also, the slime-repl-grab-old-output is an almost exact copy of slime-repl-grab-old-input. Ugly, obviously.
I'll try to improve the code a bit.
Best regards,
António Leitão.