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

Re: [PATCH] declarednull: rename DECLARED to NULL

On Mon, Dec 28, 2020 at 2:13 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> This way the logic makes more sense:
>   typeset var <- NULL(on)
>   unset var <- NULL(off)
>   var='' <- NULL(off)
> NULL means: declared, no value, but still valid even with PM_UNSET.
> No functional changes.

This is now getting a little bit weedy since only the names are under
discussion, but ... if we go all the way back to the original
discussion about this, the point was that

typeset var
print ${var-unset}

should output "unset".  Correct?

Consequently my thought was that PM_UNSET should be assigned for that
case.  Using your terminology above, NULL(on) implies UNSET(on).  To
me, that means that if there is a bit pattern named PM_NULL, it should
include the bit pattern for PM_UNSET.  In retrospect I could just have
used PM_NULL instead of PM_DECLAREDNULL but I was seeking to make it
obvious that there were two bits in the pattern when it was used as a

As one last stab at this, since neither PM_DECLARED nor PM_IMPLIED is
satisfactory, what about PM_DEFAULT ?  And scrap PM_DECLAREDNULL for
just PM_NULL.


This yields

typeset var <- NULL(on) <- DEFAULT(on), UNSET(on)
unset var <- DEFAULT(off), UNSET(on) <- NULL(off)
var='' <- DEFAULT(off), UNSET(off) <- NULL(off)


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