Zsh Mailing List Archive
Messages sorted by:
Re: Question on unintuitive behaviour for function execution and parameter assignment
- X-seq: zsh-workers 49480
- From: Jett Husher <jetthusher@xxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: Question on unintuitive behaviour for function execution and parameter assignment
- Date: Wed, 13 Oct 2021 08:42:43 +0000
- Archived-at: <https://zsh.org/workers/49480>
- In-reply-to: <firstname.lastname@example.org>
- List-id: <zsh-workers.zsh.org>
- References: <78LG0jAMo3FtN941LSwAK1kIhfcF6dszDg8-71F1TxHB3vKubQBIIAWx8yujorTI1mEI8iq4Rsahakh7IfgcNXdq2KMviv805m0imzBh5Skemail@example.com> <firstname.lastname@example.org>
- Reply-to: Jett Husher <jetthusher@xxxxx>
On Tuesday, October 12th, 2021 at 10:31, Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> This is covered by the POSIX_BUILTINS option. Generally, the POSIX_* options are
> the place to look for this sort of think --- granted that can be a bit of hunt.
I wouldn't even think to look at POSIX_* variables because POSIX-2017
explicitly tells that it's unspecified "Whether or not the variable assignments persist after
the completion of the function", so, naturally, I though that this behaviour was compliant.
> Usually an easy test to see if zsh does have the POSIX behaviour available is
> to start a new shell as
> ARGV0=sh zsh
> and see what behaviour that gives you. That should be maximally compatible,
> although it doesn't help you find which option controls the behaviour.
I would keep that in mind next time. I used to compare the executions in bash, since I thought
it's more compliant, but I guess it's not the best option since GNU also states that it
takes the standards as a recommendation and not a rule.
I still believe this needs to be mentioned in FUNCTIONS or SIMPLE COMMANDS & PIPELINES of zshmisc(1).
Or zshparam(1) perhaps? I would love to suggest my help with updating man pages but I'm not sure
if you accept commits the side. Or even how the development is done around here :shrug:
Either way, a world of thanks for the help, Peter.
Messages sorted by: