From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10906 invoked by alias); 29 Sep 2015 23:32:26 -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: 36706 Received: (qmail 8615 invoked from network); 29 Sep 2015 23:32:25 -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=-0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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== X-Received: by 10.140.150.139 with SMTP id 133mr890346qhw.58.1443569541349; Tue, 29 Sep 2015 16:32:21 -0700 (PDT) Subject: Re: Proof of concept: "static" parameter scope To: Roman Neuhauser , Oliver Kiddle References: <150924192305.ZM2680@torch.brasslantern.com> <21593.1443459899@thecus.kiddle.eu> <20150928175834.GE3670@isis.sigpipe.cz> Cc: zsh-workers@zsh.org From: Andrew Janke Message-ID: <560B1F69.3060600@gmail.com> Date: Tue, 29 Sep 2015 19:31:53 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20150928175834.GE3670@isis.sigpipe.cz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 9/28/15 1:58 PM, Roman Neuhauser wrote: > # okiddle@yahoo.co.uk / 2015-09-28 19:04:59 +0200: >> Bart wrote: >>> "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 >>> better name. >> 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"? > 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. 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"?