Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug with unset variables
On Thu, Nov 12, 2020 at 7:47 PM Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
>
> This is distinction without a difference, like saying we are not lost,
> we just don't know where we are. Conceptually it is the same thing,
> you are just using a different word for it. It's wordplay.
>
> An unset variable is for all intents and purposes a variable with a null value.
Only in languages where variables cannot have null values, and only
because you can declare "null" to be a synonym for "unset" in this
case.
> JavaScript
In JavaScript you unset a variable with `delete foo` and you assign it
a "null" value (in quotes because javascript has another null) with
`foo = undefined`. These are not equivalent.
Note that these two snippets have different effect:
var foo
and
var foo
delete foo
Just line in zsh, and unlike ksh/bash.
> Python
Same thing but `del var` and `var = None`.
Et cetera. ksh and bash are rather exceptional in this regard.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author