Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] First try of null typeset
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.
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.
These two points are independent.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author