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

Re: Bug with unset variables



On Sat, Nov 21, 2020 at 5:49 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> On Tue, Nov 17, 2020 at 2:54 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> >
> > There literally is no concept of "not defined" in the shell language
> > outside of that implicit ternary; undefined is not a first-class
> > value.
>
> This is a smoke screen.

This statement confuses me.   If you are insinuating that I'm raising
a point solely for the purpose of obfuscating the discussion, then
either (a) you haven't been paying attention to anything I've written
on this mailing list in the past 25 years, or (b) I'm forced to
believe you're actively attempting to be insulting.

> It either is *functionally* the same, or it isn't.

You keep "shouting" that word as if saying it louder is all that's necessary.

> I was not the one that brought history into the thread. You are the
> one that brought the history, which by definition cannot be changed.

You asked why zsh's default behavior is what it is; the answer is
historical practice.

Unless I've misunderstood something, the subsequent discussion has
focused on the idea that we should change the default, despite that
breaking several precedents, because the default behavior is not
internally consistent, and that the reason it's not consistent is
because of the notion that unsetting a variable is equivalent to
assigning it an undefined value.

Even if we grant the latter, which I don't think everyone does, it
still doesn't follow that the only consistent choice for the default
state of a declared variable is unset.

> My understanding of [KSH_TYPESET] is that it changed the behavior of this:
>
>     typeset var=$(echo one word)
>
> To this:
>
>   builtin typeset var=$(echo one word)

No; it changes the former to something closer to

    typeset var="$(echo one word)"

because *without* the option, it was interpreted as

>   typeset var=one word




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