Alex Goncharov | 27 Jan 02:39 2010
Picon
Picon

Would ext:exit be a good addition?

Does anybody see a downside to introducing a simple way to exit REPL
with a status, via something like `(exit 1)'?

CMUCL has 

 (defun quit (&optional recklessly-p)
   "Terminates the current Lisp.  Things are cleaned up unless Recklessly-P is
   non-Nil."

but that always exits with status 0, which is often not what is
wanted.

And (unix:unix-exit 1) is too long to type.

`exit STATUS' is so common everywhere that it should be natural to use
it in CMUCL, too.

-- Alex -- alex-goncharov <at> comcast.net --

Carl Shapiro | 27 Jan 20:44 2010
Picon

Re: Would ext:exit be a good addition?

On Tue, Jan 26, 2010 at 5:39 PM, Alex Goncharov <alex-goncharov <at> comcast.net> wrote:
Does anybody see a downside to introducing a simple way to exit REPL
with a status, via something like `(exit 1)'?

The downside is yet another way to exit the Lisp.  How many interfaces do we need?  You already mentioned two.  Is it worth spending the kludge points to add a third method?  The advantage you cited is that unix-exit is too long for you to type.  Sounds like a worthwhile addition to your personal or site init file.
Raymond Toy | 29 Jan 19:56 2010
Picon

Re: Would ext:exit be a good addition?

On 1/26/10 8:39 PM, Alex Goncharov wrote:
> Does anybody see a downside to introducing a simple way to exit REPL
> with a status, via something like `(exit 1)'?
>
> CMUCL has 
>
>  (defun quit (&optional recklessly-p)
>    "Terminates the current Lisp.  Things are cleaned up unless Recklessly-P is
>    non-Nil."
>
> but that always exits with status 0, which is often not what is
> wanted.
>   
How about overloading recklessly-p to include the exit code?  If
recklessly-p is a negative integer, do a reckless exit with and exit
code of the absolute value of the code.  If it's a positive integer,
carefully exit with the given code.

This isn't quite backward compatible.  Does anyone ever actually use a
non-nil recklessly-p?  The only difference between them is that
*cleanup-functions* isn't run.

Ray

Carl Shapiro | 29 Jan 20:12 2010
Picon

Re: Would ext:exit be a good addition?

On Fri, Jan 29, 2010 at 10:56 AM, Raymond Toy <toy.raymond <at> gmail.com> wrote:
How about overloading recklessly-p to include the exit code?  If
recklessly-p is a negative integer, do a reckless exit with and exit
code of the absolute value of the code.  If it's a positive integer,
carefully exit with the given code.

These kinds of ugly interfaces should be limited to Emacs Lisp.  If this had to change, and its not clear that it does, maybe adding keywords would be somewhat cleaner?
Raymond Toy | 30 Jan 03:37 2010
Picon

Re: Would ext:exit be a good addition?

On 1/29/10 2:12 PM, Carl Shapiro wrote:
On Fri, Jan 29, 2010 at 10:56 AM, Raymond Toy <toy.raymond <at> gmail.com> wrote:
How about overloading recklessly-p to include the exit code?  If
recklessly-p is a negative integer, do a reckless exit with and exit
code of the absolute value of the code.  If it's a positive integer,
carefully exit with the given code.

These kinds of ugly interfaces should be limited to Emacs Lisp.  If this had to change, and its not clear that it does, maybe adding keywords would be somewhat cleaner?
I think the intent was something short and simple.  If this is not clean enough, then perhaps (quite &optional recklessly-p (exit-code 0)) would be somewhat nicer, and fully backward compatible.

Ray


Gmane