From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 1d06855f for ; Fri, 11 Oct 2019 08:41:58 +0000 (UTC) Received: (qmail 9813 invoked by alias); 11 Oct 2019 08:41:51 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24343 Received: (qmail 7884 invoked by uid 1010); 11 Oct 2019 08:41:51 -0000 X-Qmail-Scanner-Diagnostics: from mail-vs1-f46.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25598. spamassassin: 3.4.2. Clear:RC:0(209.85.217.46):SA:0(-2.0/5.0):. Processed in 2.763826 secs); 11 Oct 2019 08:41:51 -0000 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.217.46 as permitted sender) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Eb4fLcC1PlgUyn4e7MzsqC6QLfLgEYssjGhsOVFy8dE=; b=r4Ml++vu6CKtMuWnuR8ilypvLmW5jyD9G3HVVtMva7hSFrnCaT923heLrkC/2RTb2Q HWRjLEt0sEVQ2IwUFE+xfM4rmmQnqOIqOszgrj9n7LCOjGr5woPqtnaF6wdF/h9mXGuL 6F+acRgLo63FzYENFC1tLa3fw+BpmAE+6aH66HOUuSB0l4xU4MBqd0GUTLs35Y1tTB9p 0mKpXXzxTnwoEFGoJME/ZPLfiuYQVokdxYZwzjfHQkYnQyrex/av1tzGuuBLXzzAq73u uraKnDtZqMNZbRHNttHG9qjsbcxCJbhqJxuWTgtA+wabCxd2ukx9qh1JBBSDo2GCSWwl iqcA== X-Gm-Message-State: APjAAAVPNPX2M+G/SJhOJJIZekwVbaJnrI9LMFREgypMOsdiqCOc8e8A vSnBMUuAA1gueWMco8byBFeXG8iqAuVJGBJFnXBOcA== X-Google-Smtp-Source: APXvYqw0izWTKE/mmzxz+qkJA7AkcEEjJczJKo4kSdSNXS+CnFMgrwqq14Hf+fTkHNhGIFP4Gur5fIODUx5MUp0Zeps= X-Received: by 2002:a67:fc49:: with SMTP id p9mr8027969vsq.198.1570783275795; Fri, 11 Oct 2019 01:41:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Sebastian Gniazdowski Date: Fri, 11 Oct 2019 10:41:04 +0200 Message-ID: Subject: Re: A tip: a technique to limit the # of global variables To: Roman Perepelitsa Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" On Fri, 11 Oct 2019 at 10:27, Roman Perepelitsa wrote: > > On Fri, Oct 11, 2019 at 10:21 AM Sebastian Gniazdowski > 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 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