From: Felipe Contreras <felipe.contreras@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: Another push on declarednull branch
Date: Mon, 28 Dec 2020 18:43:20 -0600 [thread overview]
Message-ID: <CAMP44s1X2PPv-hxCL4oqHu6VnkS755GJj+_zbFPfhBuC3zkBFQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7addhX4fzZkrOV266XLU_yW6bciiDi5aQreLjC-wG-m_w@mail.gmail.com>
On Mon, Dec 28, 2020 at 4:53 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Mon, Dec 28, 2020 at 1:46 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > On Mon, Dec 28, 2020 at 2:54 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> > >
> > > Would it make more sense as PM_IMPLICIT, so PM_NULL = (PM_IMPLICIT|PM_UNSET)?
> >
> > It's still the same problem isn't it? Why does typeset turn on
> > PM_IMPLICIT, and unset off?
>
> Typeset turns on PM_IMPLICIT because there's nowhere else that needs to.
Yes, but why PM_IMPLICIT?
The word "implicit" means unexpressed, or implied. There's nothing
implied about "typeset"; it's expressly declaring a variable.
> Unset turns it off because the variable explicitly ceases to exist;
> only its scope remains, if it had one.
Yes, the variable "ceases to exist", but it's not any less implicit.
> > Moreover, implicit what?
>
> Implicit(ly) whatever-other-flags-are-there.
I presume that doesn't apply to PM_INTEGER, PM_LOCAL, or pretty much
any flag that is not PM_UNSET.
In other words: PM_UNSET is the only flag that can be explicit, or implicit.
> > The true meaning is PM_UNSET_BUT_VALID, because the only time this
> > flag does something is when PM_UNSET is on.
>
> I don't think "valid" is a significantly more accurate description.
> $thing is "valid" whether or not you've declared "typeset thing".
Yes, but that's my point; currently (as in; in master) "valid"
variables are implicitly the ones that are !PM_UNSET, now that concept
is changing.
> Anyway, I conceived PM_DECLARED (now for this discussion PM_IMPLICIT)
> as having a meaning independent of PM_UNSET; for example
> PM_IMPLICIT|PM_INTEGER means that if you assign to the variable, the
> value is interpreted as a number.
>
> That was before I realized that "unset foo" forgets everything about
> "foo" except its scope. That is, I began from the position that
>
> typeset -f foo
> unset foo
> foo=0.3
>
> needed to resurrect foo as a float rather than a string ... but it
> doesn't, in bash/ksh. Hence unset must erase PM_IMPLICIT along with
> everything else.
OK. So now it only makes sense with PM_UNSET.
> > I think that's a clear sign the logic is not correct.
> >
> > It's the other way around
>
> Unfortunately given the bitwise implementation that condition is much
> more complicated to test for; the reversal is for convenience. Zsh is
> full of bitfield-like booleans that mean nothing unless combined with
> other such booleans.
Sure, but PM_NULL can fulfill that purpose perfectly fine (instead of
PM_DECLARED).
--
Felipe Contreras
prev parent reply other threads:[~2020-12-29 0:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-23 23:47 [PATCH] declarednull: felipec's approach Felipe Contreras
2020-12-27 18:27 ` Bart Schaefer
2020-12-27 22:06 ` Bart Schaefer
2020-12-28 20:08 ` Felipe Contreras
2020-12-28 21:00 ` Bart Schaefer
2020-12-28 21:58 ` Felipe Contreras
2020-12-27 23:04 ` Another push on declarednull branch Bart Schaefer
2020-12-28 20:22 ` Felipe Contreras
2020-12-28 20:53 ` Bart Schaefer
2020-12-28 21:46 ` Felipe Contreras
2020-12-28 22:53 ` Bart Schaefer
2020-12-29 0:43 ` Felipe Contreras [this message]
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=CAMP44s1X2PPv-hxCL4oqHu6VnkS755GJj+_zbFPfhBuC3zkBFQ@mail.gmail.com \
--to=felipe.contreras@gmail.com \
--cc=schaefer@brasslantern.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).