[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

execute* in MzScheme v199 + loading mzc-compiled files



I noticed the following entry in MzScheme's change log
(plt/notes/mzscheme/MzScheme_200.txt):
> * The `process', `process*', `process/ports', `process*/ports',
>   `system', and `system*' procedures have been moved to a new MzLib
>   library, "process.ss".
...
>   The `execute' and `execute*' procedures were eliminated entirely.

Was there a reason for taking out `execute*'? I've been using it to
restart MzScheme from within it (mostly to clear out previous
definitions before loading a new version of a program, quite like
DrScheme's Execute button). This cannot be done with the new
`subprocess' form, because I want to replace the current process, not
create a subprocess.

Actually, I don't think I'd miss execute* if I'd find some other way
of getting MzScheme to restart itself. I usually use Scheme from
inside Emacs, where I can write an elisp function to kill Scheme and
restart it, but it would sometimes be nice to be able to do it from
within the REPL.

(I've never used execute* for anything else, though I imagine someone
could use it for some sort of "loader" program, e.g., for emulating a
shell script like:
  if something; then
    exec some-program
  else
    exec some-other-program
  fi
) 


Another thing: I tried using the new foreign-function interface to
call the Unix execl(2) function in place of execute*, but ran into a
problem: MzScheme doesn't seem to load the compiled versions of my
files.

Here is the code I tried:
,----
| (c-declare "#include <unistd.h>")
| 
| (define (exec program)
|   ((c-lambda (char-string char-string) void "execl")
|    program
|    program))
`----
It compiles okay:
,----
| rjs@lambda:~/t$ /usr/local/lib/plt.v199/bin/mzc -e --prim --destination compiled/native/i386-linux restart.scm
| MzScheme compiler (mzc) version 199.19, Copyright (c) 1996-2001 PLT
| "restart.scm": 
|  [output to "compiled/native/i386-linux/restart.so"]
| rjs@lambda:~/t$ ls -l restart.scm compiled/native/i386-linux/restart.so 
| -rwx------    1 rjs      rjs         27352 Aug  9 16:26 compiled/native/i386-linux/restart.so*
| -rw-r--r--    1 rjs      rjs           135 Aug  9 16:26 restart.scm
`----
(I'm "rjs", so the compiled file is executable for me), but MzScheme
complains that my code isn't compiled:
,----
| rjs@lambda:~/t$ /usr/local/lib/plt.v199/bin/mzscheme 
| Welcome to MzScheme version 199.19, Copyright (c) 1995-2001 PLT
| > (load/use-compiled "restart.scm") 
| > (exec "/bin/ls")
| c-lambda-procedure: c-lambda expression not compiled by mzc
| > (system-library-subpath)
| "i386-linux"
| > 
`----
Am I doing something wrong? I also tried using the new module system
and compiling it as a module, but ran into the same problem.

I'm using the current v200-tagged CVS version (199.19) of MzScheme.

-- 
-=- Rjs -=- Riku.Saikkonen@hut.fi