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

Re: [PATCH] declarednull: felipec's approach



On Wed, Dec 23, 2020 at 3:47 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> This patch merges Bart's approach with my approach, and should be
> applied on top of the branch declarednull.

Thanks Filipe, I'll take a closer look at this.

> In my branch it's actually called PM_NULL because I think semantically
> makes more sense.
[...]
>
> Why would this
>
>   local var
>   var=foobar
>
> remove PM_DELCARED?

I was never especially happy with PM_DECLARED as a name, the real
semantic is "not (yet) assigned" but I couldn't think of a
short/one-word description of that.

> Additionally it's not clear why unset should clear the PM_DECLAREDNULL
> flag.

Because "not (yet) assigned" + "(currently) unset" doesn't mean the
same thing as "(explicitly) unset", in the ksh/bash examples.  Yes, it
would have been enough from the bit value standpoint to clear just
PM_DECLARED (since we're about to re-assert PM_UNSET anyway), but I
thought that made the purpose less clear when reading the code.

> I added a test that shows a discrepancy I found (${(t)var})

Ah, thanks, I forgot to go back and revisit that case.  There's no
ksh/bash equivalent of (t) so I never reached a conclusion on what the
correct behavior should be.




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