Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Another push on declarednull branch
- X-seq: zsh-workers 47777
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- Subject: Re: Another push on declarednull branch
- Date: Mon, 28 Dec 2020 14:53:26 -0800
- Archived-at: <https://zsh.org/workers/47777>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-12/CAH%2Bw%3D7addhX4fzZkrOV266XLU_yW6bciiDi5aQreLjC-wG-m_w%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-oi1-f172.google.com) smtp.remote-ip=209.85.167.172; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Pnkww89m1pjgF6sPwMcV+CLBJiQKn5sNifhPawKMQHk=; b=H30nZG2FX2Q+U47k9EpaH+JDRxAP0t9Su2VnKaV6xzEMpbA9g+U4d0dsFH/KewXj6D kaoR+NH+jIw+kdxG7J9I+0YBHjd2d4L0yONTC2EAinqRv8fR0c9LosAxABezoU45ex/e Ci0eBlNP9D7VYoy6JG72PEl1bNZfrBiTaibzud7lT0wFotu2qYcmYx9YksPodvrGvrvt zF9E4e6ssSRUZRHdUg2iWsyoSuUf1ZYhhsKLAPgoyiEal2O9/66yvNl2S4m3chxLb0/m /lrGSej8CBl6GzEoPN9uMO5QpTQGxDuMx5GqiogFcQVc5EQFCxmJsOo3oe6gvlRZQ+qA kZ9Q==
- In-reply-to: <CAMP44s0jqp=irVq7JSFoUtfuj6XsOpur=y4EXNDxneRtH=oE4g@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <20201223234711.492603-1-felipe.contreras@gmail.com> <CAH+w=7ayKmgc3qPWLr8+NHLCmmhcQxo+n=cAO3pyriTjsNpTQQ@mail.gmail.com> <CAMP44s02TKNRHr6x5=noKsvxkKKtvUbdDb40_usfOzgn-Gnmbw@mail.gmail.com> <CAH+w=7a9P0+npTgJCzzF1eFt2KFjXNs+fL1K7CFRYiBFEEQTog@mail.gmail.com> <CAMP44s0jqp=irVq7JSFoUtfuj6XsOpur=y4EXNDxneRtH=oE4g@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
On Mon, Dec 28, 2020 at 1:46 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> On Mon, Dec 28, 2020 at 2:54 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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.
Unset turns it off because the variable explicitly ceases to exist;
only its scope remains, if it had one.
> Moreover, implicit what?
Implicit(ly) whatever-other-flags-are-there.
> 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".
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.
> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author