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

Lawrence Velázquez <[email protected]>
Newsgroups gmane.comp.shells.zsh.user
Message-ID <[email protected]>
On Mon, Dec 16, 2024, at 5:15 AM, Lawrence Velázquez wrote:
> That's right; the Bourne-style function definition syntax only
> permits the body to be a command, not any sort of list (except
> within a compound command).  That leads to this fun comparison:
>
> 	% setopt SHORT_LOOPS
> 	% f() print abc && print xyz; f
> 	xyz
> 	abc
> 	% function g; print abc && print xyz; g
> 	abc
> 	xyz

Of course, as soon as I hit Send I realized I'd overlooked the
strongest form of this comparison:

	% setopt SHORT_LOOPS
	% f() print abc && print xyz; f
	xyz
	abc
	% function g() print abc && print xyz; g
	abc
	xyz

This could bite someone who's absentmindedly refactoring code.

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