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 24382
- From: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: A tip: a technique to limit the # of global variables
- Date: Fri, 25 Oct 2019 10:41:50 -0400
- Dkim-signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=klanderman.net; q=dns/txt; s=mg; t=1572014580; h=Content-Type: MIME-Version: References: Message-ID: In-Reply-To: Date: Reply-To: Subject: To: From: Sender; bh=/+Adwu/QGqkxOiYlwxMcOkt51uxn3b/pwUCbyTlmBbw=; b=QR+bfQJPgSLqH4Mg1c+bE6//7EaX6fJ5Qgf+7eCTynsirEOvfU/ABhor4zaieo2JcOF5OdM3 9czbZE2dEIk0lvw4DDSPfkBsG1q8/Znop6aMERhScD6cNeFTOJOu3C6rRc5WQm1MKHZghppy /FqRpqoE3rYh/sEqR5LliU/Z1JY=
- In-reply-to: <CAKc7PVC05MTPJXrSOC_n5NGs=08Yg6TV2wMryPsG+tH0XwEh7g@mail.gmail.com> (Sebastian Gniazdowski's message of "Fri, 11 Oct 2019 10:41:04 +0200")
- 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> <CAKc7PVC05MTPJXrSOC_n5NGs=08Yg6TV2wMryPsG+tH0XwEh7g@mail.gmail.com>
- Reply-to: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- Sender: gak@xxxxxxxxxxxxxx
IMO, just have internal vars start with '_', and use this:
| # do not complete functions/parameters that start with '_' or '.' unless explicitly matched
| zstyle ':completion:*' prefix-needed true
Greg
>>>>> On October 11, 2019 Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> 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