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

Re: Another push on declarednull branch

On Sun, Dec 27, 2020 at 5:05 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Wed, Dec 23, 2020 at 3:47 PM Felipe Contreras
> <felipe.contreras@xxxxxxxxx> wrote:
> >
> > In my branch it's actually called PM_NULL because I think semantically
> > makes more sense.
> Note I'm not rejecting your diff, just fixing things I overlooked in my own.

No worries. My patch was mostly for discussion / exploration purposes.

> I OR'd PM_UNSET into PM_DECLAREDNULL because I thought there would be
> fewer (and/or less confusing) cases where PM_UNSET had to be ignored
> than cases where both PM_UNSET and (new flag) had to be treated as
> equivalent, but having found all (hopefully) of the former it's
> probably a wash.  Maybe you can still generate a simpler patch.
> Alternate names for PM_DECLARED would be welcome.  If I could turn
> back time, I might use PM_NOTSET, and then PM_NULL ==
> (PM_NOTSET|PM_UNSET).  In fact I already like that enough better that
> I'd probably redo it that way before submitting a patch for master.

I can recreate the history of the branch as if initially that was the
case (I do it all the time in my patches for git).

However, I'm still not sure if those values make sense.

  typeset var

In this case PM_NULL, PM_NOTSET, and PM_UNSET are true.

  typeset var=''

In this case all of those are false.

  typeset var
  unset var

In this case PM_UNSET is true, but PM_NOTSET is false. Why? No value
was ever assigned.

> > I added a test that shows a discrepancy I found (${(t)var})
> New push to declarednull branch (tip is now 20e4d07b0) fixes this.
> Also added the test from Filipe's patch and another test for readonly
> declarations.

It's Felipe BTW.


Felipe Contreras

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