Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Variant syntax (Re: Could someone clarify how math functions work?)

On Dec 20, 12:35pm, Ray Andrews wrote:
} OTOH why is variant syntax there at all?

As I said, much of it isn't really "variant."  It is standard syntax
which has its uses in common cases.  There are just some productions
of the grammar that produce seldom-used combinations.

Just as you can write a magnificently obfuscated expression in C.  Or
in Python, for that matter, despite their claim of virtue.

And even what is "variant" is only "varied from traditional Bourne
shell."  In the same way that C has "lint" to report questionable but
valid programming constructions, it may be worthwhile to be able to
identify uncommon usages of shell grammar.  (Or not, since we seem to
have got along without for a quite some time, but worth discussing.)

} What does it accomplish *but* the confusion of the user?

The original intentions were:

1. A person familiar with csh but unfamiliar with Bourne shell can
   begin using zsh and feel at home.

2. An experienced user can write very brief but powerful expressions
   when interacting at the command line.  Reduces typing time/effort.
3. The expressiveness and syntax of the Bourne shell is available if
   you need it (and is encouraged for scripting, where brevity is not
   a benefit).

Note that "a person not familiar with shells at all can use this as an
introduction to *nix" is NOT on that list.  Later,

4. It's possible to do most kinds of text processing inside the shell,
   without having to fork off sed/grep/cut/paste/uniq/tee/col/wc/etc.

5. The shell can be extended with pluggable modules.

} Supposing that the goal was to rid the shell of pointless obscurities

"Pointless" is entirely subjective.

That was tried with zsh 2.5, which eventually was put out of its misery
(2.6 was based on the 2.4 code, with the retention of a few odd bits like
options with the word "JUNKIE" in the name and BARE_GLOB_QUAL).  Anyway,
if you want that, there are a whole lot of other shells floating around
("rc" being just one example) that started from scratch with that goal.

Messages sorted by: Reverse Date, Date, Thread, Author