mit-scheme-devel
[Top][All Lists]
Advanced

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

Re: [MIT-Scheme-devel] How to run a script and exit?


From: SB
Subject: Re: [MIT-Scheme-devel] How to run a script and exit?
Date: Mon, 9 Sep 2019 11:30:25 +0800

> Mon, Sep 9, 2019 at 5:10 AM Taylor R Campbell <address@hidden>
>
> Could do something like
> mit-scheme --eval '(bind-condition-handler (list condition-type:error) (lambda (c) c (exit 123)) (lambda () (load "script") (exit 0)))'
> (It is kind of silly that something like this is not built-in.)

:-) But this solution also prints ';Loading "script.scm"... ;... done' to stdout. This side effect may be undesirable for many.

Will the maintainers of MIT Scheme consider adding the ability to run scripts using the mit-scheme executable? Something like 'mit-scheme myscript.scm' on the command line. Possibly something that allows Scheme code to be turned into an executable script by adding a shebang (e.g. #!/usr/bin/mit-scheme). It is very inconvenient that there is currently no obvious way to do any of this.

Judging by the number of views and the popularity of this 10+ year question (https://stackoverflow.com/questions/903968/how-do-i-execute-a-scm-script-outside-of-the-repl-with-mit-scheme), I would guess that this is a fairly common problem. Even the answers on Stack Overflow are all wrong, because the use of shell input redirection messes with input procedures (e.g. read, read-line, etc.) if they are used.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]