From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17863 invoked by alias); 25 Jun 2015 15:46:31 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35605 Received: (qmail 10184 invoked from network); 25 Jun 2015 15:46:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:to:subject:mime-version :content-type; bh=wuI3JZImAWdqKSiYVD+NQWB4WmbhVV7A+Ttwewke8qI=; b=Wmb9NvexbzF30ePcOcUOGYIMa1wLau9V13aBuNfL44f8GZQGxu7ZkHi6YJXtZKgmNC F6hviP3F570uW628v1h2z3fRX1dDSRKTUyMjGuzOofZfXWXFy/STpHZZWOUH4VDvFDKK pc9URMNTrBhViVqFobTfVSwKsAswx9qQdQIWQj0t2Zk6ZAuNkLKGgK1zaPbFjyF/4n+N Zy/QxtmiWK4R/2az7XGRk3uyGkFXfgUgzuecIw8jDUb3wCOo8LIJi4wVKpaEnQQX8rGo FHwrdYKVKkuEdC7+b6w6UEx7oty0+LciQj5zmmByKWaHiCF2b5FeOgfBa6MeFu0PqB9A C3qg== X-Gm-Message-State: ALoCoQn3pRHQNx5Xl22u5FqCoZ4n6ukyz6ndQgJkhV9kjbp1UbPdvYgrdpimQQW4npPp/XPTc5/u X-Received: by 10.182.247.102 with SMTP id yd6mr25015934obc.39.1435247187742; Thu, 25 Jun 2015 08:46:27 -0700 (PDT) From: Bart Schaefer Message-Id: <150625084618.ZM20163@torch.brasslantern.com> Date: Thu, 25 Jun 2015 08:46:18 -0700 X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Obtaining the names of all local variables MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Oliver mentioned: > I did something like the following in _git recently. It works > arr=( one two three ) > local $arr This got me thinking, wouldn't it be helpful if zsh/parameter had an array $locals that holds the names of all the local parameters? Then you could needs_private_scope() { local -h $locals; ... } It then occurred to me that it might be more natural to have "local" handle this. But: torch% () { local +m \* } (anon): bad option: -m Of course there's an ambiguity in both cases; given typeset bar scope1 () { local foo } scope2 () { local foo bar scope1 } Should "bar" be considered local in scope1 when called from scope2? If not, this whole idea is somewhat moot; you'd need a way to select which scope you want to know all the locals in, which is ugly to contemplate.