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

Re: inconsistency of invalid identifier error messages



Peter wrote:
> Presumably this is connect to parsing subscripts?  unset 'a[b]' is not an
> error if a is an associative array (even if the element b doesn't exist),
> though 'a[b' obviously is.

Yes. For unset 'a[b]' to not be an error is entirely consistent with
unset b not being an error when there is no b variable.

What I think should change is that unset 'a-b' should produce an error.

> > invalid parameter name: a-b
>
> I think this one is probably clearest.  ("Parameter" isn't a very good word
> for a variable, but that's too widespread to do anything about.)
> 
We've also got:
% vared not-here
vared: no such variable: not-here

I actually think there would be some sense to trying to use variable for
the documentation and error messages even if the internals and some
things like the zsh/parameter module can't be changed. Similarly the
documentation could prefer declare to typeset.

> Hmmm... "-" *is* an identifier if $- is a parameter.  Maybe the test

Exactly. So the ideal error message would be one complaining that `-' is
readonly.

Oliver



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