zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] declarednull: rename DECLARED to NULL
Date: Wed, 6 Jan 2021 09:33:49 -0800	[thread overview]
Message-ID: <CAH+w=7a5xzztvJ9hRB-2-LyzyZFx74Pfy5z8cJu01=hOh_AHQw@mail.gmail.com> (raw)
In-Reply-To: <4e9d7283-94fa-4862-ab04-8c3294f3876c@www.fastmail.com>

On Wed, Jan 6, 2021 at 8:02 AM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Bart Schaefer wrote on Mon, 04 Jan 2021 21:57 +00:00:
> > So the "bits that need to be named" are:
> > 1) the bit representing "remember that this was declared but no value
> > was assigned"
> > 2) the combination of that with PM_UNSET that represents "functionally
> > behaves like NULL"
>
> To be clear, (2) would generally be used as testing whether _either_
> PM_UNSET or the bit from #1 is set, right?

Most often it's used for changing the value of both bits at once, not
testing.  The bits are almost always tested independently.

> How about, for #1, PM_BEEN_ASSIGNED or PM_INITIALIZED?

The latter was already rejected.  Both of these arguably describe the
opposite of the actual state, that is, PM_HAS_NOT_BEEN_ASSIGNED would
be more accurate ... but Felipe has essentially argued that after
"unset foo" the variable still has not been assigned, so why clear a
bit with that name?

PM_DECLARED_BUT_NEITHER_ASSIGNED_NOR_UNSET is just too verbose, and
shortening it to just the first word got us into this discussion in
the first place.

> As to the combination, my first inclination would have been to leave it
> unnamed so that it's obvious PM_UNSET is being inspected, but if the
> combination merits being named, then perhaps PM_HAS_VALUE(pm).

The reason for doing it the way I did is because (I presumed) most
cases would never examine bit #1 because they are already examining
PM_UNSET by itself.

PM_HAS_VALUE(pm) is actually also backwards.  It would usually be
PM_HAS_NO_VALUE(pm).  But there's actually exactly one such test.


  reply	other threads:[~2021-01-06 17:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-28 22:13 Felipe Contreras
2021-01-03  1:18 ` Bart Schaefer
2021-01-03  2:38   ` Felipe Contreras
2021-01-03 18:26     ` Bart Schaefer
2021-01-04  6:17       ` Daniel Shahaf
2021-01-04 21:57         ` Bart Schaefer
2021-01-06 16:02           ` Daniel Shahaf
2021-01-06 17:33             ` Bart Schaefer [this message]
2021-01-07 15:48               ` Daniel Shahaf
2021-01-07 22:29                 ` Bart Schaefer
2021-03-27 19:24               ` Lawrence Velázquez
2021-03-27 20:42                 ` Bart Schaefer
2021-03-29  0:44                   ` Oliver Kiddle
2021-04-10 18:56                     ` Bart Schaefer
2021-04-10 21:58                       ` Oliver Kiddle
2021-04-10 22:35                         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7a5xzztvJ9hRB-2-LyzyZFx74Pfy5z8cJu01=hOh_AHQw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).