[racket] Recompile and restart

From: Laurent (laurent.orseau at gmail.com)
Date: Fri Jan 11 10:07:53 EST 2013

Hem, here's a probably more multi-platform and general version (and one
that I can edit on pastebin):
http://pastebin.com/pKKpp0Tz

It's now using `syntax-source-module' for the file path, but I'm not sure
how much I can rely on it, and it's also using
(find-executable-path (find-system-path 'exec-file))
to be able to run the file independently of its name, and here too I'm not
sure if it will work as needed all the time.

Laurent

On Fri, Jan 11, 2013 at 2:58 PM, Laurent <laurent.orseau at gmail.com> wrote:

> 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/533503b0/attachment.html>

Posted on the users mailing list.