Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: why not promote the plague ? (brace|rc|alternative|modern) syntax
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author