Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCHv2: the ::= fix in 54674 was incomplete



On Sat 20 Jun 2026, at 10:02, Mikael Magnusson wrote:
> Any strong opinions?

we already discussed on irc, but just to put it on record, my opinion is
that the result of ${x::=y} should be as identical as possible to x=y
and then $x, regardless of whether x is a basic name or a subscript or
slice

there are one or two cases where following that rule produces an
arguably non-useful expansion, but that's fine imo

you mentioned on irc that that's technically inconsistent with the use
of the word 'parameter' in the docs -- given the surrounding context and
the way it already works with single subscripted elements i think that's
just an oversight. here's a fix for that

dana


diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index b91c90932..cbdaddead 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -663,7 +663,7 @@ item(tt(${)var(name)tt(::=)var(word)tt(}))(
 In the first form, if var(name) is unset then set it to var(word); in the
 second form, if var(name) is unset or null then set it to var(word); and
 in the third form, unconditionally set var(name) to var(word).  In all
-forms, the value of the parameter is then substituted.
+forms, the value of var(name) is then substituted.
 )
 xitem(tt(${)var(name)tt(?)var(word)tt(}))
 item(tt(${)var(name)tt(:?)var(word)tt(}))(




Messages sorted by: Reverse Date, Date, Thread, Author