Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] declarednull: rename DECLARED to NULL
- X-seq: zsh-workers 47802
- From: "Daniel Shahaf" <d.s@xxxxxxxxxxxxxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] declarednull: rename DECLARED to NULL
- Date: Wed, 06 Jan 2021 16:02:12 +0000
- Archived-at: <https://zsh.org/workers/47802>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-01/4e9d7283-94fa-4862-ab04-8c3294f3876c%40www.fastmail.com>
- In-reply-to: <CAH+w=7ZX8ddgLH3DdsrCg6pgxY8KbRo1nqF5qLxZ2HL0JtcWNw@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20201228221342.136199-1-felipe.contreras@gmail.com> <CAH+w=7aHddgDB9jbKoL2pceNwPM48pF6+V3oiHzd8versYVW7w@mail.gmail.com> <CAMP44s2v4dJJe8XhGfzzvsANMiT25COreKEhuqF3VgEfqSZ4Fg@mail.gmail.com> <CAH+w=7ZL0KGcd8b4mmRhMSPuX-bEgMZi5XG7G37vLo1m87GUAg@mail.gmail.com> <20210104061718.GB14783@tarpaulin.shahaf.local2> <CAH+w=7ZX8ddgLH3DdsrCg6pgxY8KbRo1nqF5qLxZ2HL0JtcWNw@mail.gmail.com>
Bart Schaefer wrote on Mon, 04 Jan 2021 21:57 +00:00:
> On Sun, Jan 3, 2021 at 10:17 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > Could you summarize the bits that need to be named and the corresponding shell
> > language incantations/semantics?
>
> There has been a series of threads about this, but to try to summarize:
>
> In current zsh,
> typeset -i var
> typeset -p var
> print ${var-foo}
> produces the output
> typeset -i var=0
> 0
⋮
> This disagrees with e.g. bash/ksh, so the proposal is that with
> POSIXBUILTINS set, the same three commands would output
> typeset -i var
> foo
>
Thanks for the summary.
> 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"
>
> We could of course simply never name #2 and always write out the
> bitwise-OR, but that seems cumbersome.
>
To be clear, (2) would generally be used as testing whether _either_
PM_UNSET or the bit from #1 is set, right?
How about, for #1, PM_BEEN_ASSIGNED or PM_INITIALIZED?
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).
> As I understand it, the objection to PM_DECLARED for #1 is that the
> name implies that only "unset var" should ever turn that bit off
> again, but the implementation requires that assignment also turns it
> off. Similar objections of English language semantics conflicting
> with the implementation have been raised to other names I've
> suggested.
*nod*
Cheers,
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author