Newsgroups: comp.lang.tcl
From: simpson@esm.com (Scott Simpson)
Date: 1 Nov 95 22:10:09 PDT
Organization: Scott Simpson's Home Computer
bdc@rolex.mit.edu (Brian D. Carlstrom) writes:
> Scsh has a high-level process notation for doing shell-script like tasks:
> running programs, establishing pipelines and I/O redirection. For example,
the
> shell pipeline
>
> gunzip < paper.tex.gz | detex | spell | lpr -Ppulp &
>
> would be written in scsh as
>
> (& (| (gunzip) (detex) (spell) (lpr -Ppulp)) ; Background a
pipeline
> (< paper.tex.gz)) ; with this
redirection
>
You're right. This is much easier to type than the Bourne shell line
above. Jeez...
Good point, Scott. You are absolutely right -- that pipeline is easier to type
in sh or csh. The classic shell notation that you like is tuned for invoking
programs... but terrible for doing anything else. You would not, for example,
really want to write a spreadsheet or an optimising compiler in sh. But it's
quite pleasant to write these kinds of programs in Scheme (at least, I
enjoy it).
Scsh, as it currently stands, is really more a programming language than an
interactive command language. If you want to write a shell script, then scsh
gives you a much more powerful programming language to use than the Bourne
shell: real data structures like records, vectors, and floating point numbers;
first-class procedures; real environment structures like closures, and so
forth. On the other hand, if you wish to fire up a pipeline in the middle of
your program, then in addition to all of these standard programming language
features, scsh *also* gives you a shell-level notation. You would probably be
irritated by having to type in those few extra parens for an interactive
command you plan to enter once and throw away, but for a shell script, they
don't really matter much, and they buy you a lot: the ability to embed that
high-level process notation in the middle of a real program. You can do
sophisticated things in the middle of your shell script -- that's pretty
handy.
I explore these issues in a paper I wrote on the Scheme shell. If you
are interested in reading more about these sorts of things, you
can grab a copy from
ftp://ftp-swiss.ai.mit.edu/pub/su/scsh/scsh-paper.ps
One day, we'll do a parser front-end for scsh that provides a convenient
command-language syntax, with escapes to Scheme for the more complex
tasks. Till then, like you, I am planning to stick with tcsh and bash for my
interactive, command-language interpreters. Even though I am the designer
and implementor of scsh.
By the way, some other poster was wondering why the scsh announcement had
appeared in the tcl group. TCL is a scripting language. We thought people
interested in scripting languages might be interested to know about the
release. Further discussion of the Scheme shell probably belongs in
comp.lang.scheme
or
alt.lang.scheme.scsh
-Olin
|