Re: why not promote the plague ? (brace|rc|alternative|modern) syntax

Lawrence Velázquez <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>
On Fri, Dec 13, 2024, at 6:05 PM, Marc Chantreux wrote:
> you don't even need braces. so actually both are working by default:
>
> 	for a in foo bar baz; echo $a
> 	for a ( foo bar baz ) echo $a
>
> this works
>
> 	integer i=10; while (( --i ))  echo $i
>
> this doesn't
>
> 	integer i=10; while (( --i ));  echo $i
>
> both of them work
>
> 	integer i=10; repeat 10; echo $[i--]
> 	integer i=10; repeat 10 echo $[i--]

Mikael's point was to distinguish between the alternative forms
and the SHORT_LOOPS forms.  None of your examples works without
SHORT_LOOPS:

	% unsetopt SHORT_LOOPS
	% for a in foo bar baz; echo $a
	zsh: parse error near `echo'
	% for a ( foo bar baz ) echo $a
	zsh: parse error near `echo'
	% integer i=10; while (( --i )) echo $i
	zsh: parse error near `echo'
	% integer i=10; repeat 10; echo $[i--]
	zsh: parse error near `echo'
	% integer i=10; repeat 10 echo $[i--]
	zsh: parse error near `echo'

-- 
vq
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.