Hi!
Olin Shivers <shivers@lambda.ai.mit.edu> writes:
> From: Chris.Bitmead@alcatel.com.au (Chris Bitmead uid(x22068))
> Subject: Re: Ousterhout and Tcl lost the plot with latest paper
> Date: 18 Apr 1997 10:24:54 +1000
>
> I've often thought that if I ever wrote a Scheme shell, I would
> provide an option to put in a line prefix and suffix to lines just to
> satisfy this point. You might do something like this...
>
> $ scheme
> > (write 'foobar)
> 'foobar
> > (set! prefix "(")
> (> set! suffix ")")
> (&)> write 'foobar
> 'foobar
[snip]
> I would suggest that you'd be better off sticking with a classic
> shell-like syntax for the common, everyday issuing of commands, not
> simply punting the outer layer of parens. Globbing, for example, is
> an important interface between the filesytem and the command line arguments
> given to programs. This is built in to the syntax of typical interactive
> shells.
With all due respect, I believe Chris's suggestion is much more
elegant. I would implement it by having a user-specifiable
`eval-string' function, which seems cleaner (or maybe by cloning a
sub-repl that uses a specified eval function).
Then, his original example would look like:
$ scheme
> (write 'foobar)
'foobar
> (set! scsh-eval-string (lambda (cmd)
(eval-string
(string-append "(" cmd ")")
*top-level-envt*)))
> write 'foobar
'foobar
And, to satisfy you, Olin, we could have:
> (set! scsh-eval-string olins-fancy-eval-string-function)
> help
Olin's fancy eval string function has a syntax identical to the Bourne
Shell [...]
Builtin commands:
eval evaluates its arguments in the Scheme interpreter
eval-print same as `eval' but displays the results
exit leave scsh
> ls *.c
foo.c hello.c main.c
> eval "(write \"some scheme command\")"
some scheme command
> eval "(* 2 3)"
> eval-print "(* 2 3)"
6
> exit
$
I don't think it is wise to force users to have the same syntax. To
make it easier for beginners, we might have a standard shell-like
eval-string function that would use some special syntax in order to
evaluate scheme commands.
Anyway, with interactive functionality like the above, command
completion and history (easy to get via something like GNU readline,
if scsh doesn't have it already), and paren matching, I would
instantly start playing with scsh.
Then, it would only be a matter of evolving the default eval-string
function to a point where it is useful.
Sorry if some of my comments are irrelevant: I don't know what
features scsh already supports because I keep balking when I see the
FAQ saying that there is no interactive support yet, and it seems your
plans require `sophisticated Scheme hacking techniques.'
I would prefer the simple but extensible approach.
Thanks for your comments,
--Gord
|