help / color / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Sebastian Gniazdowski <sgniazdowski@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: A tip: a technique to limit the # of global variables
Date: Fri, 11 Oct 2019 10:26:59 +0200
Message-ID: <CAN=4vMq7CJjaYyfnWzrGCbomf9HaDha5xTRbnQP6fVk1g5Oh7g@mail.gmail.com> (raw)
In-Reply-To: <CAKc7PVDfuyP0Q8AOazMDtRetg6ZWDGqFhu1KT3927a-Ze4RFxQ@mail.gmail.com>

On Fri, Oct 11, 2019 at 10:21 AM Sebastian Gniazdowski
<sgniazdowski@gmail.com> 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


      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11  8:20 Sebastian Gniazdowski
2019-10-11  8:26 ` Roman Perepelitsa [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMq7CJjaYyfnWzrGCbomf9HaDha5xTRbnQP6fVk1g5Oh7g@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link


Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git