zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] declarednull: rename DECLARED to NULL
Date: Sat, 2 Jan 2021 17:18:24 -0800	[thread overview]
Message-ID: <CAH+w=7aHddgDB9jbKoL2pceNwPM48pF6+V3oiHzd8versYVW7w@mail.gmail.com> (raw)
In-Reply-To: <20201228221342.136199-1-felipe.contreras@gmail.com>

On Mon, Dec 28, 2020 at 2:13 PM Felipe Contreras
<felipe.contreras@gmail.com> 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
mask.

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.

#define PM_NULL (PM_DEFAULT|PM_UNSET)

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)

??


  reply	other threads:[~2021-01-03  1:18 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 [this message]
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
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=7aHddgDB9jbKoL2pceNwPM48pF6+V3oiHzd8versYVW7w@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=felipe.contreras@gmail.com \
    --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).