Re: PATCH: ::= didn't respect parameter flags
Mikael Magnusson <[email protected]> Wed, 10 Jun 2026 18:17:41 +0200
| Newsgroups | gmane.comp.shells.zsh.devel |
|---|---|
| Message-ID | <CAHYJk3QVQXtH_0hBZnVRnvzLJdPr7bmiM1S+8Rxxv2Ceix53jQ@mail.gmail.com> |
On Wed, Jun 10, 2026 at 6:38 AM Bart Schaefer <[email protected]> wrote: > > On Thu, Jun 4, 2026 at 12:16 AM Mikael Magnusson <[email protected]> wrote: > > > > We agreed that at least the latter is definitely disagreeing with what you would > > expect and the documentation. > > I meant to reply to this sooner. Does this change in any way impact > the 25 "Rules" in doc section 14.3.3? Presently that doesn't mention > assignment forms at all, but there are a number of explicit orderings > of expansion flags with respect to each other and with respect to > nested expansions, and I think it could be argued that > ${(A)uniquearr::=$duplicates} contains a nested expansion. Perhaps > this at least needs clarification? Hm, I did come up with a case that you might argue would affect where the assignment forms should be inserted if they were, % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset -u foo=bar; echo $foo ${(P)${foo::=bar}}' BAR upper BAR lower % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset -u foo=bar; echo $foo ${(PU)${foo::=bar}}' BAR UPPER BAR LOWER while all of these remain the same, % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset -u foo=bar; echo $foo ${(P)${(U)foo::=bar}}' BAR upper BAR upper % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset foo=bar; echo $foo ${(PU)${foo::=bar}}' bar LOWER bar LOWER % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset foo=bar; echo $foo ${(P)${(U)foo::=bar}}' bar upper bar upper % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset foo=bar; echo $foo ${(PU)${(U)foo::=bar}}' bar UPPER bar UPPER So the difference is only that parameter flags take effect in the same place as parameter expansion flags for assignment forms now, which is what, as mentioned, the documentation for the assignment forms already said it did. None of these non-nested forms appear to change, % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset foo=bar; echo $foo ${(PU)foo::=bar}' bar BAR bar BAR % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset foo=bar; echo $foo ${(PU)foo}' bar LOWER bar LOWER % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset -u foo=bar; echo $foo ${(PU)foo::=bar}' BAR BAR BAR BAR % () { zsh -c $1; zsh-5.9-mika -c $1 } 'bar=lower; BAR=upper; typeset -u foo=bar; echo $foo ${(PU)foo}' BAR LOWER BAR LOWER If you, or anyone, have a specific change to suggest to the list of rules, that would be nice. -- Mikael Magnusson