Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: A tip: a technique to limit the # of global variables
- X-seq: zsh-users 24343
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: A tip: a technique to limit the # of global variables
- Date: Fri, 11 Oct 2019 10:41:04 +0200
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Eb4fLcC1PlgUyn4e7MzsqC6QLfLgEYssjGhsOVFy8dE=; b=bmrheCjSDNXkOvUZwfeLWOMZdYMatg5pQwb2/EJrma8K1Fp1Won73lMEfzl/CdqGlp WGDFECTM/WmbdQ/QZbWjj58cq8wpB1+jT1DcZJMwfTCEcqOmV7R6F7DgXlPPhO6N/jhH bFF3oR4M6y6HhIawOq24g+4j1Wy11J/uD3Pd/F/PwYDbZpf6VCVcl2ZnMon+QyuryUHN ngp4C3hFEwEtFAGPai0yyLi1Yl4PiNN9roBCzN+9ISO4a8W4dJ2mwUJEbRUz1UT1g9di 0xNr4/9nFjCRCxbpCCMgkst3kmGGCdrRrtbBe9Ak1cIKxi43b4VMHmPVu93chI0PAdZa IG6A==
- In-reply-to: <CAN=4vMq7CJjaYyfnWzrGCbomf9HaDha5xTRbnQP6fVk1g5Oh7g@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVDfuyP0Q8AOazMDtRetg6ZWDGqFhu1KT3927a-Ze4RFxQ@mail.gmail.com> <CAN=4vMq7CJjaYyfnWzrGCbomf9HaDha5xTRbnQP6fVk1g5Oh7g@mail.gmail.com>
On Fri, 11 Oct 2019 at 10:27, Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> 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.
I think that it's about not "cluttering" the global namespace with the
parameters. Zplugin had 37 global parameters, now it has only 16. Even
a situation when a curious user enters print $ZPLG<TAB> and sees fewer
entries is positive. This hides implementation, on the other hand, but
one can decide what to hide when writing, i.e. what isn't meaningful
for a curious user.
PS. The message should go to zsh-users, hence I'm moving it there.
--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
Messages sorted by:
Reverse Date,
Date,
Thread,
Author