Franklin Chen <chen@adi.COM> wrote:
>I'm surprised nobody besides me has mentioned that ML already has this
>kind of syntax, and that since the proposed ideas look so much like
i've done some ML programming, and the syntax really annoyed me. that
was programming, not interactive use, but i don't think it would work
there either.
Ob constructive ideas:
i think interactively as soon as you type more than a short line, the
cost of typing parens is won back by their clarity. but avoiding
parens for quick issue of commands is important. in current scsh i
have to say
> (run (chmod +r README))
which is too verbose because the RUN and the parens are explicit. but
i'm happy to type something like
> (map (lambda (f) (rename-file f (replace-extension f ".cc")))
(glob "*.c"))
aside: higher order control structures are soo useful, but i would
like shorter names for some of the procedures like replace-extension
(nick-names).
so anyway the question is: how can we lose the parens, and use this
instead
> chmod +r README
without losing the ability to use the longer form above, or any valid
syntax such as
> (+ 1 2)
one thing the parens give us is independence of the newline. but
interactively we want to use the newline. so let's say if there's
more than one form on the line
> form0 form1 ...
it's assumed to be an abbreviated form, and is expanded to
(run (form0 form1 ...))
backquote would still function as a means of refering to variables,
so:
> rm ,a
corresponds to (run (rm ,a)), and A is properly referenced (lisp ,
behaves like shell $). but there's a glitch: what if the program
doesn't need an argument? since
> foo
is just one form, it would refer to the variable instead. my guess is
the user is more likely want to execute a command than to reference a
variable, so i would also expand a single interactive form if it is an
atom. if you *do* just want the value, then just use procedure that
does nothing (you might want to use different name):
> (values foo)
note that s48 already has a mechanism for paren-less commands: try
,help sometime.
|