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

Re: A tip: a technique to limit the # of global variables



On Fri, Oct 11, 2019 at 10:21 AM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
>
> Hello,
> when writing a plugin one often needs to keep a state during the Zsh
> session. To do this it is natural to use global parameters. However,
> when the number of the parameters grows one might want to limit it.

What are the advantages of having fewer global parameters? Why is it
better to have this:

    typeset -gA PLGMAP=(foo 42 bar hello)

Than this:

    typeset -gi PLGMAP_foo=42
    typeset -g  PLGMAP_bar=hello

Roman.



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