<div dir="ltr">Hem, here's a probably more multi-platform and general version (and one that I can edit on pastebin):<br><a href="http://pastebin.com/pKKpp0Tz">http://pastebin.com/pKKpp0Tz</a><div class="gmail_extra"><br>
</div><div class="gmail_extra">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 <br>(find-executable-path (find-system-path 'exec-file))<br>
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.<br><br>Laurent<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 2:58 PM, Laurent <span dir="ltr"><<a href="mailto:laurent.orseau@gmail.com" target="_blank">laurent.orseau@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi all,<br><br></div>Here's a funny little piece of code:<br>
<a href="http://pastebin.com/G9BG9v7j" target="_blank">http://pastebin.com/G9BG9v7j</a><br></div>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.<br>
<br>To run in the console (won't work inside DrRacket).<br><br></div>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. <br></div>
<div><br>In particular:<br><br></div><div>- Is there a risk of memory leak somewhere with that kind of code?<br><br><div>- Is there a context in which this code may break?<br></div><br>- 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.<br>
</div><div><br></div><div>- Is `subprocess' good enough for the job? Or do I need to invoke a more low level fork?<br><br></div><div>- 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?)<br>
</div><div><div><br></div><div>Any other comment is appreciated.<br></div><div><br></div><div>Thanks,<br></div><div>Laurent<br></div></div></div>
</blockquote></div><br></div></div>