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

Re: One possible answer to typeset vs. unset

On Tue, Dec 1, 2020 at 12:55 AM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> I don't know what would be the proper solution for tied variables, but
> I used this hack to make the tests pass:

I looked at this for a while yesterday evening.  My conclusion is that
tied variables are already a bit of a hack.

It would be nice to be able to determine null-ness (however that ends
up being defined) in bin_typeset where we are actually examining the
"assigns" list of names+values, but the determination of whether a
parameter is being localized or is having its type changed in a
value-preserving compatible way (e.g., typeset -F SECONDS) is down in
typeset_single.  And typeset_single is called twice for tied
variables, always in the same order no matter which of the pair is
being initialized, which is then cleaned up afterward in bin_typeset.
So something convoluted has to be done, especially if both parts of
the pair are supposed to appear "null" when neither is given an
initial value.

Consequently I don't know if your patch would cause a different test
for unset-ness (that hasn't been written yet) to fail, but something
like that patch may be unavoidable.

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