<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">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>