zsh-workers
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Bart Schaefer <schaefer@brasslantern.com>,
	"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [PATCH] First try of null typeset
Date: Thu, 3 Dec 2020 03:18:16 -0600	[thread overview]
Message-ID: <CAMP44s0nHTK55rmEYmnOtQgJkeheQFKRdpVkkyWDPNUs5-i6gg@mail.gmail.com> (raw)
In-Reply-To: <CAN=4vMr5+XgoySB95GnUDgZjwseS=_EEM6pGs4Snbazm=nQGoA@mail.gmail.com>

On Thu, Dec 3, 2020 at 2:44 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> On Wed, Dec 2, 2020 at 10:59 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > On Wed, Dec 2, 2020 at 12:48 PM Bart Schaefer <schaefer@brasslantern.com> 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


      reply	other threads:[~2020-12-03  9:18 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
2020-12-03  8:44     ` Roman Perepelitsa
2020-12-03  9:18       ` 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=CAMP44s0nHTK55rmEYmnOtQgJkeheQFKRdpVkkyWDPNUs5-i6gg@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=roman.perepelitsa@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).