Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] First try of null typeset
- X-seq: zsh-workers 47715
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: [PATCH] First try of null typeset
- Date: Wed, 2 Dec 2020 15:59:09 -0600
- Archived-at: <https://zsh.org/workers/47715>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-12/CAMP44s1CPeZKaabML8iyguTnmoBSUNPUkPKMpoY4JpHC3tQdug%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-wr1-f48.google.com) smtp.remote-ip=209.85.221.48; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=f1sJtngk76TzgDYClDchHiD5sSF7KnW1EGc5BvDtZhE=; b=T02IQNDjtNxHd89GGMocnAtJSFJz707FQyVcg+3QNb2R337XYW5JZrGjbrJZdSKlw7 cUElcqm1cOs/tBDSRIhFsijnt5gDYDX0++Y5QKOzOlATZZkHaZS81Q7XVTKdlufo6Tif hr62syRLG/TV1vDTN+Rbq8Lq1vLjRV80WXvGkmDi2lbgYnvOHmODGeJMmA7/4Ad4pZ27 nwLxvOlRvf1fmpllS1UPn6blf/dQXQhQFx2HPNwiyus/EFaTJQEpx9pjwKsZHrN88caq LC5AZB4AWC2KAGVN0kEFUjqCvJGr/YY9rcvSAZH3cCFW6MvwD+EO0zG5w+kkJoxPFZnT Z3fQ==
- In-reply-to: <CAH+w=7YWnwDTKV4meJO_KhYE7QfdXVfMnQ8pHOb45TgS4R_GvA@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: <20201201091342.310763-1-felipe.contreras@gmail.com> <CAH+w=7YWnwDTKV4meJO_KhYE7QfdXVfMnQ8pHOb45TgS4R_GvA@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
On Wed, Dec 2, 2020 at 12:48 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Tue, Dec 1, 2020 at 1:13 AM Felipe Contreras
> <felipe.contreras@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author