From: Olin Shivers
Subject: Shell syntax and Scheme (Reply to Chris Bitmead)
Date: 
Message-ID: <qij912h7zub.fsf_-_@lambda.ai.mit.edu>
    From: ·············@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

    As you see, by setting the prefix and suffix variables a "(" and ")"
    would automatically be prepended and appended to each line you
    type. The prompt would change to "(&)" to remind you that this is in
    effect. If you wanted a shell like a Unix shell that runs other
    processes you might change it to "(run &)" which would automatically
    call the run procedure on anything you type in. This would allow you
    to type ls -l at the prompt and have it work.

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.

If you wanted to do an interactive shell on top of Scheme, you would
want to implement a lexer/parser to handle the shell syntax. You would
also want to tweak the design of the shell syntax to allow escapes to
Scheme for complex things. Having escapes to Scheme syntax and semantics
would punt a lot of unnecessary things from your simple, interactive
command language that are necessary for scripting, because you always
have Scheme for them, such as conditionals and other control-flow operators.

I discuss these issues at some length in the papers I've written on scsh,
the Scheme shell. You can find them at
    http://www.ai.mit.edu/~shivers/
by following the link to "Technical papers."

I would further suggest that you'd be even better off punting this whole
idea of the command-line/transcript model of shell interaction. You could
instead use the emacs editor Edwin (written in Scheme) together with the
Unix API provided by scsh to do a screen-oriented shell, where common
commands would be bound to control keys, less common commands invoked from
meta-x, and complex operations performed by entering fragments of Scheme
and scsh process notation. Best of both worlds -- interactivity and 
programmability.

I've always wanted to do this, but it's not the sort of thing for which
I'm promoted.
    -Olin
From: Alaric B. Williams
Subject: Re: Shell syntax and Scheme (Reply to Chris Bitmead)
Date: 
Message-ID: <3357d3ad.12133146@news.demon.co.uk>
On 17 Apr 1997 23:51:40 -0400, Olin Shivers
<·······@lambda.ai.mit.edu> wrote:

>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.

But how about (glob <filespec>), which returns a list of string
filenames...

(cat "alaric.txt")

(cat . (glob "*.txt"))

Saves all that messiness of escape codes and so on!

ABW
--
"Plug and Play support: WfEWAD will autodetect any installed
Nuclear Arsenals, Laser Satellites, Battlefield Control Networks,
Radar Installations, Fighter Squadrons, and other WfEWAD compliant
devices, including the new Macrosoft Unnatural Keyboard, with
full support for the now-famous Big Red Buttom(tm)."

(Windows for Early Warning and Defence User's manual P26)

Alaric B. Williams Internet : ······@abwillms.demon.co.uk
<A HREF="http://www.abwillms.demon.co.uk/">Hello :-)</A>