From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id CAA12285 for ; Fri, 5 Jul 1996 02:08:27 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id LAA23767; Thu, 4 Jul 1996 11:58:52 -0400 (EDT) Resent-Date: Thu, 4 Jul 1996 11:58:52 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960704085853.ZM5356@candle.brasslantern.com> Date: Thu, 4 Jul 1996 08:58:51 -0700 In-Reply-To: Zoltan Hidvegi "Re: cshjunkieparen bothers me (and always has)" (Jul 4, 3:14pm) References: <199607041314.PAA11866@bolyai.cs.elte.hu> Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.702 02jul96) To: Zoltan Hidvegi Subject: Re: cshjunkieparen bothers me (and always has) Cc: pws@ifh.de, zsh-workers@math.gatech.edu MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"N4eb63.0.Hp5.ye-sn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1527 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu 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"