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

Re: uninvited members of associative array



it certainly is to be said that, even if the shell implements all the basic programming constructs, it is meant for different objectives then those that are targeted by the things one most commonly calls "programming languages", and even among those there are many distinctions, so probably it wouldn't be so easy to establish an exact definition that includes only the "ideals" (whatever that means) programming languages and leaves everything else out. That being said, I think that one should accept the language for what it is and what is meant to be and do, and even if something would be awesome if it was engineered with  hindsight (like array expansion without empty string elision with a more same syntax, or by default) it should be wise to understand what the language is or is not before dipping too much one's arms and feets in it, reading the manual at least a couple of times front to bottom, since someone has put the effort to write it. At least I try to do it this way, I experiment a bit but then I try to read everything I can before resorting to ask for help, it seems only fair given that someone has to put aside whatever he is doing to answer me.

Pier Paolo Grassi


Il giorno sab 17 dic 2022 alle ore 00:33 Ray Andrews <rayandrews@xxxxxxxxxxx> ha scritto:

On 2022-12-16 14:15, Bart Schaefer wrote:
>
> I'd appreciate a pointer to that definition, since apparently my PhD
> in Computer Science is from too long ago to have covered it.

Ha!  Sometimes hairs need to be split, and Dominik is surely correct
that zsh and say C are very different, but to say that zsh isn't a
programing language will be a chore to sustain.

Daniel:

> You mean that you wrote foo[bar] and didn't realize that was
> a globbing syntax too?  zsh can't disable features because you don't
> know them.

This stuff is all so fundamental that it couldn't change even if
everyone wanted it to.  Disable isn't the word I chose.  But there is
something very unfriendly about situations where you're doing something
with an array index -- and it obvious at least to oneself that this is a
string thing, and then zsh zealously applies filename expansions to it
when it has nothing whatsoever to do with files.  I don't mind being
clobbered, that's part of learning the shell, still it isn't very
intuitive.  Anyway I've learned the protections.   But one can want to
do some string globbing and still hope not to have anything to do with
filenames.





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