zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Zoltan Hidvegi <hzoli@cs.elte.hu>
Cc: pws@ifh.de, zsh-workers@math.gatech.edu
Subject: Re: cshjunkieparen bothers me (and always has)
Date: Thu, 4 Jul 1996 08:58:51 -0700	[thread overview]
Message-ID: <960704085853.ZM5356@candle.brasslantern.com> (raw)
In-Reply-To: Zoltan Hidvegi <hzoli@cs.elte.hu> "Re: cshjunkieparen bothers me (and always has)" (Jul  4,  3:14pm)

On Jul 4,  3:14pm, Zoltan Hidvegi wrote:
> Subject: Re: cshjunkieparen bothers me (and always has)
>
> > I *think* this is what happened:
> > 
> > Cshjunkieparen at one time affected whether
> > 
> > 	if [[ $TERM == xterm ]] then
> > 
> > would work.  This was the csh compatibility feature, even though it
> > wasn't precisely csh syntax.  I have no idea why "paren" was used in
> > the name of the option.
> 
> This syntax is really a ksh compatibility syntax.  But by a more general
> rure it is a POSIX compatibility syntax.

That may be, but there wasn't any such thing as `POSIX compatibility' (at
least within zsh) at the time that it was originally introduced as csh
compatibility.

> The biggest problem using braces instead of then ... fi is the following:
> 
> if (true)
> { echo yes; }
> 
> The patch I posted recently to the manual says that it is equivalent to
> 
> if (true)
> then
> 	echo yes
> fi
> 
> But that's not true since par_list parses a list as long as it is possible
> so the above is the same as
> 
> if (true) ; { echo yes; }
> 
> And now a then or an open brace should come after some semicolons.  I think
> csh junkies do not like that change.

I don't think csh junkies care one way or the other.  C junkies might,
but braces are not a command-grouping syntax in csh EXCEPT in exactly
one circumstance:

	#! /bin/csh
	if { something } then
	    echo something succeeded
	endif

I.e., in "if" (and possibly "while", I forget) statements, using braces
instead of parens is equivalent to:

	#! /bin/csh
	something
	if ( $status == 0 ) then
	    echo something succeeded
	endif

> if true {
> 	echo yes
> }
> 
> does not work either since { behaves like a reserved word (POSIX says that
> { and } should be reserved words).

That's equivalent to passing '{' as an argument to 'true', which is fine.
No problem with that either from a csh junkie standpoint; you can't omit
the parens in csh.  I note that this works:

	if { true } {
	    echo yes
	}

> To summarize this after Bart's patch the
> 
> if (foo)
> {
> 	...
> }
> 
> syntax will not work

But that in turn means that

	if [[ -f foo ]]
	{
	    ...
	}

has never worked, or at least hasn't worked for quite some time.  (Boy,
sometimes I wish my old machine with the 2.0.0 zsh on it hadn't died.)
In any case, I think this bit of consistency is worthwhile.


-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



      reply	other threads:[~1996-07-04 16:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-30  7:19 Bart Schaefer
1996-07-01 19:19 ` Bart Schaefer
1996-07-01 21:02   ` Zoltan Hidvegi
1996-07-01 21:35     ` Anthony Heading
1996-07-02  1:03       ` Bart Schaefer
1996-07-02  8:48   ` Peter Stephenson
1996-07-02 19:35     ` Bart Schaefer
1996-07-04 13:14       ` Zoltan Hidvegi
1996-07-04 15:58         ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960704085853.ZM5356@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=hzoli@cs.elte.hu \
    --cc=pws@ifh.de \
    --cc=schaefer@nbn.com \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).