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 Sat, Dec 14, 2024, at 6:36 PM, Lawrence Velázquez wrote:
> Other than the `for' variants, none of these (or the short forms
> below) requires parentheses _per se_.  What they require is that
> their conditions be, as zshmisc(1) so vaguely puts it, "suitably
> delimited".  These are all valid:
>
> 	% if ! ( true ) { print true }
> 	% if [[ x ]] && { false } { print true }
> 	% if true; ! [[ x ]] { print true }
> 	% if print ignored | (( 0 )) { print true }
> 	%

But:

	% if { true } { print true }
	true
	% if f() { not executed yet } { print true }
	true
	% if () { true } { print true }
	zsh: parse error near `}'

Anonymous functions accept arguments, so the end of an anonymous
function _body_ does not delimit the anonymous function _command_.

-- 
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.