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

Re: The emulation rabbit-hole RE typeset/unset



On Sat, Nov 28, 2020 at 10:56 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Nov 28, 2020 at 3:36 AM Felipe Contreras
> <felipe.contreras@xxxxxxxxx> wrote:
> >
> > An integer is not a "simple scalar", and seems to be useful unset.
> >
> > Or am I missing something?
>
> Two things.  Possibly three.
>
> One, 'the only useful "declared but not set" variable is a simple
> scalar' was a statement on the ambiguity of the austin-group proposal
> that you excerpted, which explicitly made "declared but not set"
> equivalent to "unset".

Yes, but this is a statement of fact. It either is true or it isn't.
And to me it looks like it isn't.

> Two, that neither bash nor ksh actually does make those two things
> equivalent.  Variables in bash and ksh can either have both properties
> and values, or only properties, or neither.  Variables in zsh
> currently have only the two states of both or neither, because the
> latter is the definition of being unset.
>
> This is what we've been saying all along -- zsh currently has no
> provision for representing "only properties", and consequently the
> only way to get any of the behavior of the properties settable by
> typeset options is to provide a default value.  The only thing zsh can
> currently represent independent of some value is function scope.

I'm not talking about what is currently the case in zsh. I'm talking
about what should ideally be the case. For bash, for ksh, for POSIX,
and consequently for zsh.

> Three, maybe, is that math expression context has a special definition
> of the meaning of an undeclared name, which is not the same as the
> definition in the rest of the shell.  It's not a parameter expansion
> in the normal sense.

No, but it's still useful.

Cheers.

-- 
Felipe Contreras




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