scsh-users
[Top] [All Lists]

Re: Perl, English, syntax for Scheme and shells (was Re: scsh in scm ...

To: wilson@cs.utexas.edu
Subject: Re: Perl, English, syntax for Scheme and shells (was Re: scsh in scm ...)
From: Tod Olson <tao@stone.lib.uchicago.edu>
Date: Fri, 05 Jan 1996 20:23:13 -0600
Cc: scsh@martigny.ai.mit.edu
Reply-to: Tod Olson <ta-olson@uchicago.edu>
Here is a suggestion from H. Boom, in response to another incarnation
of the "Parens are Bad" thread, proposed and posted over a year ago:

    Message-ID: <31mamr$8kc@cumulus.CAM.ORG>
    Subject: Re: Why we must somtimes have lisp/scheme after all. (WAS: What 
other experimental languages connect to a windowing system?)
    From: hendrik@CAM.ORG (Hendrik Boom)
    Newsgroups: 
comp.lang.functional,comp.lang.lisp,comp.lang.misc,comp.software-eng
    Date: 2 Aug 1994 16:35:39 -0400
    Lines: 34

    I hear the usual complaints on this thread about Lisp's parentheses.
    There's been lots of syntaxes for different constructions that would
    otherwise be unreadable because of the parentheses.  But there's a simple
    way to deal with most of the parentheses.

            Whenever a parenthesized phrase occurs at the end of another.
            use a slash instead of parenthesizing it, thus:
                    (abf gut ( hnniuf slks))
            becomes
                    (abf gut / hnniuf slks)
            this gets rid of most of the parenthesis clusters in Lisp.
    It makes it easy to use "if" instead of "cond",
    or a "let" without a list, because many such constructs naturally 
    nest in their last argument.

    P.s. another candidate for a "/" is a semicolon, but that looks better at 
    the end of a lin than at the beginnning:

            ( if onions bagels
            / if cows milk
            / let horse pony
            / list onions cows horse
            )

            ( if onions bagels ;
              if cows milk ;
              let horse pony ;
              list onions cows horse
            )
    In my experience, with this feature, most Lisp read-macros
    become unnecessary, and much syntactic sugar likewise.

            hendrik.



I've not used this method myself, but have known people to swear by
it.  Gads, it makes this C programmer happier the more I think about
it.  Editing looks and feels much like C, you retain the parens for
when you need them (sort of like C's block structure), and it's still
nice to parse.  It's brilliant in its simplicity and it is certainly a
legible notation, and that's much of what people are asking for.

One feature of an interactive shell that's been largely ignored here
is the command line editor.  I think everyone takes emacs or vi style
command line editing, a la ksh/bash/etc., for granted.  But what about
the way the zsh does multiple line editing?  That's a *big* win in my
book.  I *like* the ability to develop scripts interactively at the
command line, then pop them into a real editor once they cross a
certain threshold of size and complexity.  But more importantly, if
your command line editor supports multiple line editing as zsh does
you don't have to try to make you language still be legible when
everything is crammed into one line.

Suppose your command line editor also automatically supplies the
closing paren / bracket / brace whenever you type the opening one.  Do
some of the parens suddenly become acceptable?  Maybe enough to not
worry about infix expression notation?  What can you reasonably expect
from the command line editor?

I think that Boom's notation (or some variant), with zsh-style
commandline editing (and maybe with balanced parens, et al.) would
make a very nice, very simple interactive environment.

Tod A. Olson                        "How do you know I'm mad?" said Alice.
ta-olson@uchicago.edu               "If you weren't mad, you wouldn't have
The University of Chicago Library    come here," said the Cat.

<Prev in Thread] Current Thread [Next in Thread>