zsh-workers
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] First try of null typeset
Date: Wed, 2 Dec 2020 15:59:09 -0600	[thread overview]
Message-ID: <CAMP44s1CPeZKaabML8iyguTnmoBSUNPUkPKMpoY4JpHC3tQdug@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7YWnwDTKV4meJO_KhYE7QfdXVfMnQ8pHOb45TgS4R_GvA@mail.gmail.com>

On Wed, Dec 2, 2020 at 12:48 PM Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Tue, Dec 1, 2020 at 1:13 AM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > This achieves most of what Bart Schaefer's version achieves, except no extra hacks are needed, and
> > integer and floats are not changed.
>
> Applying the change to integers and floats is one of the reasons I
> went in the direction I did.

Yes, I suspect that's the way it will eventually have to be done, but
others argued "typeset -i var" should initialize it to 0. So for those
my patch already does what is needed.

> What constitutes an "extra hack"?

The one I did to fix the PM_TIED case. I sent a patch for that.

> > In my opinion a separate concept of "null" variable will be needed, and should be separate from
> > PM_UNSET, since that changes a lot of behavior.
>
> I don't think it's possible to introduce a separate concept of "null"
> inside struct param without touching at least all the same places my
> branch already did, and probably others.  I would not be unhappy to be
> proven incorrect, but PM_UNSET already covers all the corner cases of
> what to do when a parameter should be treated as having no value,
> because that's how "local" followed by "unset" has always worked.

But as you showed the code assumes PM_UNSET variables don't exist.

I could comb through to code looking for instances PM_UNSET checks,
but I'm sure I will find some instances where the code doesn't do what
we want in that case.

> > Also, I don't think $empty[(i)] should return nothing, so probably paramsubst() would need to be tuned
>
> Agree.  This may be easier than it seems, because (i)/(I) already work
> on scalars: { thing="abcde"; print $thing[(I)] } yields 6.  I just ran
> out of time to dig further.

Yes, me too. My patch did the lazy thing too and just doesn't return anything.

> > Addtionally, this patch doesn't change the behavior of the private module.
>
> If by this you mean my branch changed something about "private" in a
> way that doesn't correspond to the rest of the changes, then I've
> overlooked something.

No. Your patch may be doing the desired behavior. Presumably if
"typeset var" doesn't set a value for var, then "private var"
shouldn't either.

I'm just saying my patch doesn't do that (although it probably should).

Cheers.

-- 
Felipe Contreras


  reply	other threads:[~2020-12-02 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  9:13 Felipe Contreras
2020-12-02 18:47 ` Bart Schaefer
2020-12-02 21:59   ` Felipe Contreras [this message]
2020-12-03  8:44     ` Roman Perepelitsa
2020-12-03  9:18       ` Felipe Contreras

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=CAMP44s1CPeZKaabML8iyguTnmoBSUNPUkPKMpoY4JpHC3tQdug@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).