This is the mail archive of the kawa@sourceware.cygnus.com mailing list for the Kawa project. See the Kawa home page for more information.


[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: exit (no!)



> Could there be a Special.exit object? In case an evaluation returns this
> object Shell.run returns normally. Why? So I can use Shell.run for
> interaction over a tcp/ip connection. I don't want the remote user to
> shut down my system by typing "(exit)". I just want the shell
> interaction to stop and my system to wait for a new client.

Typing:
	#!eof
seems to work.  #!eof is the end-of-file object.  If the reader returns
the #!eof object, this is the same as end-of-file, which causes the
read-eval-print-loop to terminate.

However, it does not work to:
	(define (exit) #!eof)
	(exit)
That just *evaluates to* #!eof, which does *not* cause the repl to terminate.

I think this behavior is reasonable, so I don't want to change it.

I don't think adding a Special.exit would be very useful, since the
semantics woudl be weird.  What might make sense would be to have
(exit) throw something like an ExitException.  Then 'main' would catch
this exception, and exit.  You could then (optionally) have each
repl also catch this exception.

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner