[racket] Recompile and restart

From: Laurent (laurent.orseau at gmail.com)
Date: Fri Jan 11 08:58:13 EST 2013

Hi all,

Here's a funny little piece of code:
http://pastebin.com/G9BG9v7j
When you click on the button, it appends an instruction at the end of the
file, recompiles itself, closes itself and restarts itself with the new
program.

To run in the console (won't work inside DrRacket).

Since I'm most probably going to use a similar code in a project, if anyone
has comments on how to do things better, I'm all ears.

In particular:

- Is there a risk of memory leak somewhere with that kind of code?

- Is there a context in which this code may break?

- I'm not sure about the ports with `subprocess'. The docs say they must be
closed, but since I'm using the current ones, I thought probably not.

- Is `subprocess' good enough for the job? Or do I need to invoke a more
low level fork?

- It uses getpid from mzlib/os, which is deprecated. Is there a replacement
for that? Will mzlib/os be removed in the future? (and so should I copy the
relevant code into my project?)

Any other comment is appreciated.

Thanks,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130111/aefb5d6a/attachment.html>

Posted on the users mailing list.