[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

syntax



There's been minor discussion on this list lately as to whether or
not some sort of extend-syntax macro business is a Good Thing
for the shell.  Clearly, as Paul said, we need it to understand infix
and postfix, not just prefix, and there is little former art in that
area.  However, I have something to add that I think is worthwhile.
I'm big on real examples.  You want Feature X?  Well, tell me why
you want it, give me an example of how it will do you good.

My real example is that extensible syntax will make "programming the
inputs" all that much easier.  By which I mean, you make your code
output things that can be moused straight up and sent back into the
shell.  I first saw this on V8 and it's a great idea.  Plan 9 carries
the idea much farther: the Plan 9 kill command doesn't do any actual
killing, it just outputs rc commands that could be used to do such
killing if you decide to send them.  And so forth.  But you can't
always guarantee that the output is _all_ going to be _syntactically_
valid input, without going to trouble or making it ugly.  Example:
the mail system I use outputs lines like this describing mail items:

- +vwar buzel -   Ed L'Esperance < Wed, 17 Feb 1993 "Tim's Spaghetti"

Now I can mouse up the _initial_ part of that line:

- +vwar buzel

and send it, and have the "-" command display the mail item for me.  Good
design, thanks Boyd.  But, and although the foul smell of xterm is
partially responsible for this, even with the best-designed window
program in the universe it's always going to be easier to mouse up
a whole line than a partial one.  But the whole line isn't going to
be syntactically acceptable in most cases.  It'd be nice to be able
to say, however:

	syntax '-' ::= builtin '-' with: $1, $2, ignore(...)

or something equally hand-wavey.

More comments from Chickenhawk Software, where the main rotor's never
tied down.

OK,
John.