So to clarify my original confusion, := does nothing on a parameter
declared with typeset -Z3 because it expands to be padded before
checking if it's "empty", despite actually being unset, and ::= shows
the assigned value ignoring the parameter flags (but the flags aren't
actually cleared, they just aren't used for the particular expansion
that used ::=).
Would we consider either or both of these to be bugs?
The fact that the ::= expansion doesn't use the parameter flags clearly seems to be a bug. Note that = and := suffer from the same issue. See for example the expansion of ${i=5} in the 4th command below. It expands to 5 instead of 005.
The fact that = and := first expand the parameter before deciding whether it's unset or null also seems bogus to me. The documentation suggests that the parameter itself is tested rather than its expansion. Distinguishing between unset and null arguably also only makes sense for the parameter. The expansion can be null (empty string) but not really unset.
However, this issue isn't limited to = and :=. All expansion forms seem to work on the expanded value of the parameter rather than its native value:
% zsh -c ' unset i; echo {${i-1}} {${i:-2}} {${i+3}} {${i:+4}} {${i=5}} {${i:=6}}'
{1} {2} {} {} {5} {5}
% zsh -c ' typeset i; echo {${i-1}} {${i:-2}} {${i+3}} {${i:+4}} {${i=5}} {${i:=6}}'
{} {2} {3} {} {} {6}
% zsh -c ' typeset -Z3 i; echo {${i-1}} {${i:-2}} {${i+3}} {${i:+4}} {${i=5}} {${i:=6}}'
{ } { } {3} {4} { } { }
% zsh -c 'setopt TYPESET_TO_UNSET; typeset -Z3 i; echo {${i-1}} {${i:-2}} {${i+3}} {${i:+4}} {${i=5}} {${i:=6}}'
{1} {2} {} {} {5} {005}
If the behavior is changed for = "" :=, then it should certainly also be changed for the other expansion forms.
In your 2022 mail, you had the following:
% typeset -Z3 i
% echo ${i=5}
005
I can't reproduce this:
% zsh -c 'typeset -Z3 i; echo {${i=5}}'
{ }
I suspect that when you ran that code, i was already initialized with 5:
% zsh -c 'i=5; typeset -Z3 i; echo {${i=5}}'
{005}
Philippe