In article <firstname.lastname@example.org>,
Paul Wilson <email@example.com> wrote:
>What's interesting to me about this is that people who have tried to
>put a less "objectionable" syntax on Lisp or Scheme have usually
>tried to make it look more like an algebraic language? Why? Why
>not make it look like a shell language, only better?
This is the kind of language I've been exploring in the Q language.
See the files in ftp.cygnus.com:pub/bothner/Q.
Most relevant is Qshell.texinfo and Qshell.ps in Q.doc.tar.gz.
I haven't had much time to work on Q the last few years, but I'm
starting to think about it again. Now, I think it would make most
sense as "Q-script", that is a front-end to Scheme, Guile, or Java.
> 2. You still parenthesize other subexpressions. I think this may
> be less objectionable than it seems at first glance.
This may be objectionable in interactive use.
You would like to not have to quite "foo" (so you make cd a macro).
You also would prefer to leave out the parentheses:
My idea is as follows: First, we use '\\' to indicate continuation,
as is traditional for C and Unix. So translating "Scheme-script"
to Scheme first must get rid of those markers. Then you surround
each non-empty line with parentheses, assuming the line has no
unmatched pathentheses. Also, a non-empty segment following
the last unmatched '(' in a line is parenthesized, as is a non-empty
segment preceding the first unmatched ')' in a line.
define (foo a b) \
(cond (eq? a b
bar a b 1 \
2 3 4)
foo b a))
(define (foo a b)
(cond ((eq? a b)
(bar a b 1
2 3 4))
(foo b a))))
Note we get undesired parentheses around #t. Just like Scheme
has self-evaluating forms, Scheme-script has self-applying values.
"Applying" a value to an empty parameter list just returns
the value itself. The same applies to functions that require
at least one argument. A rule like this is needed if we want
to actually "apply" date, which is what beginner naturally expect.
This idea gets rid of many parentheses. Combining it with Paul
Wilson's idea gets rid of more. There are of course other syntax
changes we should try. For example, we should combine define, let,
let*, letrec into a single declaration form.
> 2. How do we distinguish between calls to built-in or user-defined
> Scheme functions and commands that are sent to programs outside
> Scheme? For scsh, you currently have to explicitly indicate
> that you want to run a UNIX program by using a (run ...) form
> or whatever. I think this may be the right default for
> nontrivial programs, but for many scripts it's awkward. Somebody
> (John Ellis?) did a Lisp shell several years ago, where any
> unbound function name was assumed to be an indication that
> the programmer meant to call a UNIX program. So, for example,
> if rm was bound, (rm foo) meant call the rm procedure, but if
> rm was unbound, the shell would look for a unix program named
> rm, and call it with the argument foo.
A tricky problem is how to handle standard output from a Unix program
(that has not been re-directed). Should this go to standard output of
the Scheme interpreter, or should it be consider the "result" of
applying the Unix program? See my Qshell paper (mentioned above)
for one answer.
Cygnus Support firstname.lastname@example.org