Zsh Mailing List Archive
Messages sorted by:
Re: Proof of concept: "static" parameter scope
- X-seq: zsh-workers 36706
- From: Andrew Janke <apjanke.floss@xxxxxxxxx>
- To: Roman Neuhauser <neuhauser@xxxxxxxxxx>, Oliver Kiddle <okiddle@xxxxxxxxxxx>
- Subject: Re: Proof of concept: "static" parameter scope
- Date: Tue, 29 Sep 2015 19:31:53 -0400
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=Wx0RcMODlrtYdL/1znF5+I9H1NGIODaCsRTnlxWEXYQ=; b=my6Ji31+sd3X7jmjfRhD4xJF1IWj3DU1eP2qyUU+yMr28L8iiYbIuwBps2+7d6GBvU PrYx0kQt+8dUDIQu1j/Kfm4x/3+MnjYb62vfa797r3rqA6C/xG1E/y26Mn9mjfWJk7NN GFtLNFxMpAwrWvKniHOqZm1pZTTVjh9bGTN7Xd11RcA6u0G/G37DGyRzcK3Mi6KR4ln8 AnVICDq9/VDuB/O+QrmkJvtGm3OBtpT50YNNBC/OUZoIXLYad3n2ZDdlQFKTjlwZX8M+ TfhERFTCRx67Trk7cEZEREz+VpjCHd9XKsmMkUQgq47G07wNibjmruH3DDgc4LL6tWAw +Gdg==
- In-reply-to: <20150928175834.GE3670@isis.sigpipe.cz>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <150924192305.ZM2680@torch.brasslantern.com> <email@example.com> <20150928175834.GE3670@isis.sigpipe.cz>
On 9/28/15 1:58 PM, Roman Neuhauser wrote:
I'm a fan of "my". Perl's "my" and "local" are exactly the example I use
when explaining the behavior of zsh "local" variables to new users. This
new scope seems to correspond pretty well to Perl's "my" lexical scoping.
# okiddle@xxxxxxxxxxx / 2015-09-28 19:04:59 +0200:
"Called functions" includes recursive calls to the function itself, so
this doesn't work like C "static". Therefore I'm in the market for a
The trouble with "static" is that people with a C or C++ background will
expect something different. It might be better to find a new word in the
thesaurus that doesn't carry the baggage of another common meaning. Note
that, as you mention in the documentation patch, ksh93 has a typeset
-S option which does do C like static variables. Aside from confusing
users, the Zsh use of the term "parameter" seems even more tenuous when
applied to lexically scoped variables because they can't be used as
named parameters. So instead of "static" I would simply suggest "var".
agree wholeheartedly with everything Oliver said.
one nitpick: "var" has no semantics regarding scope, which is not a
problem per se, but with 'local' doing something (naively) unexpected,
maybe a stronger signal would be in order?
i'd maybe suggest "private" instead, but the sweet succintness of "var"
is really attractive. hmm, what about "my"?
Or maybe "auto"? The C "auto" storage class (the default one, scoped to
a block in a function activation) corresponds pretty well to this new
static scope, since it's scoped to a single function activation / call
stack frame (as opposed to a stack frame and all its child frames).
Or maybe "reallylocal"?
Messages sorted by: