Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] First try of null typeset
- X-seq: zsh-workers 47718
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: [PATCH] First try of null typeset
- Date: Thu, 3 Dec 2020 03:18:16 -0600
- Archived-at: <https://zsh.org/workers/47718>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-12/CAMP44s0nHTK55rmEYmnOtQgJkeheQFKRdpVkkyWDPNUs5-i6gg%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-wr1-f66.google.com) smtp.remote-ip=209.85.221.66; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, "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=W5BwCUSUVGk+j3u+a/EMinMWXTnV8k5wcHxjJuWnJ3k=; b=mkai6PsGSdup68Pg/5lhjO8EkxxZ6zhuJpKZN8ygKk39I/rRwKKvC6/EvBs+wHsaew uukn0LTObAR2pXmuSLp7yCE3Z4gLtZW2iDTsGUCMVJ2JcMsvEcfPXQbHTQ+r6yxIcUya 8luD6+LaZAbZDXHH64WHaNw1TVZxy0u1Shy9ULvBtnZJHEOG/yD1vhqN+nPwM1p7tG5Y XnMD/OdYPEl7zMpBjtIoBwP+/eSTKpSPYlQ62Ja02ePqaWVMpLase6cYT6iIi3rZzQ85 GzCH/B8CLYAO9I01kLNOzCrxCJOQXgpu+WJZy3/RSSkQeWyQqoceJKqnMxSAm7LBmARm HGEQ==
- In-reply-to: <CAN=4vMr5+XgoySB95GnUDgZjwseS=_EEM6pGs4Snbazm=nQGoA@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> <CAMP44s1CPeZKaabML8iyguTnmoBSUNPUkPKMpoY4JpHC3tQdug@mail.gmail.com> <CAN=4vMr5+XgoySB95GnUDgZjwseS=_EEM6pGs4Snbazm=nQGoA@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
On Thu, Dec 3, 2020 at 2:44 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> On Wed, Dec 2, 2020 at 10:59 PM Felipe Contreras
> <felipe.contreras@xxxxxxxxx> wrote:
> >
> > On Wed, Dec 2, 2020 at 12:48 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > >
> > > 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.
>
> I've two opinions here.
>
> The first is that it's not a good idea to introduce a mode in which
> `typeset var` declares an unset variable but `typeset -i var` doesn't.
> The motivation for changing the behavior of `typeset var` is to be
> more compatible with other shells. However, there is no shell where
> `typeset [flag]... var` leaves or doesn't leave the variable unset
> depending on flags.
That's *one* motivation, it's not the only motivation.
Another motivation is to do the right thing, which POSIX after decades
of discussion hasn't managed to agree on what is the right thing.
If zsh somehow managed to find the right thing, and the right thing is
for "typeset -i var" to set a value while "typeset var" doesn't, then
that would solve a lot of future problems.
Alas, I don't think that's the right thing.
> My second opinion on this matter is that it's not a good idea to
> change the behavior of `typeset -i var` in native mode with default
> options. The benefits (if any) of this change would be too small to
> justify braking user code.
Agreed, at least not now (maybe the next major version).
But it can be changed in some mode(s).
--
Felipe Contreras
Messages sorted by:
Reverse Date,
Date,
Thread,
Author