Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug with unset variables



On Sun, Nov 22, 2020 at 11:27 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> Nope. I demonstrated how they are functionally the same with plenty of examples.

All of your examples are from other languages.

> But then you used an historic argument to counter my claim that Zsh
> was not consistent.

The historic reference was for context.  The actual argument is that
zsh is consistent because the behavior of variables inside function
scope mirrors that of variables at global scope.  History is merely
why variables behave that way at global scope.

Your argument is that zsh was wrong to adopt that interpretation of
variables in function scope.  That doesn't make it (internally)
inconsistent, it just makes it different.

But there are plenty of other ways that the shell language is
different from pretty much any other language you can name.  Korn has
spent years and many revisions gradually dragging in concepts from
other languages.  Zsh has so far (often just for lack of developer
time/attention) not attempted to track with all of those.

However ...

> I argued it makes sense to add a setopt option that turns on the
> behavior that a) in my opinion is more consistent, b) is what Bash and
> ksh does, and c) is the equivalent of what virtually all languages do.

That's where we could have been ten days ago, but you said (of
changing the default) ...

"Nothing is impossible. It's just harder when you don't even think of
trying it."

... so we've been down the rabbit hole of arguing necessary/desirable.

To hopefully tie this off, does anyone want to argue for a new option
instead of adding this to KSH_TYPESET?




Messages sorted by: Reverse Date, Date, Thread, Author