From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26400 invoked by alias); 24 Mar 2011 09:39:05 -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: X-Seq: 15887 Received: (qmail 210 invoked from network); 24 Mar 2011 09:39:03 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at necoro.eu does not designate permitted sender hosts) Message-ID: <4D8B1128.2090405@necoro.eu> Date: Thu, 24 Mar 2011 10:38:48 +0100 From: =?UTF-8?B?UmVuw6kgJ05lY29ybycgTmV1bWFubg==?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110323 Lightning/1.0b3pre Thunderbird/3.1.9 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Re: Local inner functions References: <4D8A810A.3050300@necoro.eu> In-Reply-To: X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig252AB62319D131BFB48D2F98" --------------enig252AB62319D131BFB48D2F98 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 24.03.2011 02:41, schrieb Bart Schaefer: > On Wed, Mar 23, 2011 at 4:23 PM, Ren=C3=A9 'Necoro' Neumann wrote: >> >> foo () >> { >> bar () { } >> } >> >> Is there some way of making 'bar' to be local to 'foo'? Using the >> 'local' keyword does not work :). > > The short answer is "no." And you can't make local aliases either. > > The slightly longer answer is that there are a couple of ways to fudge > it, of varying degrees of hackishness. Thanks for your answer. Instead of your 'always'-block, I tried trap 'unfunction bar' EXIT - but of course this is no good in case of name clashes :). So, if nothing like this really works (and local functions are not been to be implemented into zsh), I'll just use the $0_bar approach (wasn't aware of this), to at least reduce the chance of clashes. - Ren=C3=A9 --------------enig252AB62319D131BFB48D2F98 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk2LES4ACgkQ4UOg/zhYFuAB7gCghPHGjhTxun4D1wFfSYjiOiSg cbQAn3pKM1o/orr/xBILYNAeiqOT8fI/ =Ipvb -----END PGP SIGNATURE----- --------------enig252AB62319D131BFB48D2F98--