zsh-workers
 help / color / mirror / code / Atom feed
* Re: Could someone clarify how math functions work?
       [not found] ` <20141219093551.5a89e4d9@pwslap01u.europe.root.pri>
@ 2014-12-20 19:37   ` Bart Schaefer
  2014-12-20 20:35     ` Ray Andrews
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2014-12-20 19:37 UTC (permalink / raw)
  To: zsh-workers

[> workers]

On Dec 19,  9:35am, Peter Stephenson wrote:
}
} I'm wondering, however, if we can do a bit better by strengthening the
} warnings against variant syntax --- whose sole role appears to be to
} confuse the user --- and provide some kind of good practice guide for
} complex syntax such as functions, loops, etc.  But would anyone read it?

Grammatically, "subshell() ( ... )" is not "variant syntax" it's just an
uncommon usage of the standard syntax.  SHORT_LOOPS on the other hand ...

Either way, we could introduce an option similar to WARN_CREATE_GLOBAL
that prints runtime (parse time? "verbose" output time?) warnings for
some of these things.  It'd take a bit of work to track down all the
cases we might want to warn about.

Then one could e.g.
	zsh -o warn_odd_syntax -n scriptfile

We'd have to decide whether multios are in this category, etc.  There is
no clear line between zsh-specific syntax that one might use intentionally
and "variant" syntax that one might use accidentally.  And subshells are
even more a case of "did-he-mean-that?" when used where a current-shell
construct in braces would be more common.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Could someone clarify how math functions work?
  2014-12-20 19:37   ` Could someone clarify how math functions work? Bart Schaefer
@ 2014-12-20 20:35     ` Ray Andrews
  2014-12-20 22:09       ` Variant syntax (Re: Could someone clarify how math functions work?) Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Ray Andrews @ 2014-12-20 20:35 UTC (permalink / raw)
  To: zsh-workers

On 12/20/2014 11:37 AM, Bart Schaefer wrote:
> [> workers]
>
> On Dec 19,  9:35am, Peter Stephenson wrote:
> }
> } I'm wondering, however, if we can do a bit better by strengthening the
> } warnings against variant syntax --- whose sole role appears to be to
> } confuse the user --- and provide some kind of good practice guide for
> } complex syntax such as functions, loops, etc.  But would anyone read it?
I would.  OTOH why is variant syntax there at all?  What does it 
accomplish *but* the confusion of the user?  The culture seems to be one 
in which it is considered good that one can do things in 50 different 
ways.  I understand that in Python culture they make a virtue out of 
saying that there is only ever *one* way to do whatever it is that you 
are doing, which means that reading Python must be a breeze because one 
does not have to learn 50 dialects of the language. That's probably 
going too far IMHO, tho.

Speaking as the newcomer here, the agony of learning zsh is that it is 
so encrusted with these ancient confusions and obscure gotchas and 
exceptions and variations and deep mysteries going back to the Chaos 
before the World was created.  Supposing that the goal was to rid the 
shell of pointless obscurities rather than adding another layer of 
safety nets to help one cope with them?

Kill variant syntax! Less is more.  What's that saying: "The code is 
perfect, not when there is nothing more to add, but when there is 
nothing more to take away."  Simplicity and clarity matter. Burn, burn, 
burn.

rant rant rant ;-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Variant syntax (Re: Could someone clarify how math functions work?)
  2014-12-20 20:35     ` Ray Andrews
@ 2014-12-20 22:09       ` Bart Schaefer
  2014-12-20 22:56         ` Ray Andrews
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2014-12-20 22:09 UTC (permalink / raw)
  To: zsh-workers

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Variant syntax (Re: Could someone clarify how math functions work?)
  2014-12-20 22:09       ` Variant syntax (Re: Could someone clarify how math functions work?) Bart Schaefer
@ 2014-12-20 22:56         ` Ray Andrews
  0 siblings, 0 replies; 4+ messages in thread
From: Ray Andrews @ 2014-12-20 22:56 UTC (permalink / raw)
  To: zsh-workers

On 12/20/2014 02:09 PM, Bart Schaefer wrote:

Bart, you and I are both examples of our type.  I can rightly be accused 
of not being ready for big girl's panties yet, OTHO when one has spent 
ca. 30 years getting familiar with things, everything looks easy.  It is 
my lack of experience that is precisely my advantage, because, not being 
familiar, I can point out things that really are strange.  One day I'll 
be used to them and not notice anymore but that will not be a good thing.
> The original intentions were:
>
> 1. A person familiar with csh but unfamiliar with Bourne shell can
>     begin using zsh and feel at home.

Very considerate, I just wonder how relevant that is in real world now.  
I dunno, maybe very relevant, but I suspect that zsh is now fully 
independent and can do the best thing regardless of historical 
considerations.  Or not, I'm just ranting.
> 2. An experienced user can write very brief but powerful expressions
>     when interacting at the command line.  Reduces typing time/effort.
>   
Indeed, some of that stuff is unbelievably powerful.
>
> } Supposing that the goal was to rid the shell of pointless obscurities
>
> "Pointless" is entirely subjective.

Not entirely.  I think we'd all very much agree on a definition of 
'pointless'.  Something that is confusing and that adds no real 
functionality is pointless. Obsolete syntax is pointless. Unused 
compatibility stuff is pointless.

> 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.
>
Interesting that my thinking is not without precedent.  Anyway, no point 
in flogging dead horses.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-20 22:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <54939F50.50102@gmx.com>
     [not found] ` <20141219093551.5a89e4d9@pwslap01u.europe.root.pri>
2014-12-20 19:37   ` Could someone clarify how math functions work? Bart Schaefer
2014-12-20 20:35     ` Ray Andrews
2014-12-20 22:09       ` Variant syntax (Re: Could someone clarify how math functions work?) Bart Schaefer
2014-12-20 22:56         ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).