zsh-users
 help / color / mirror / code / Atom feed
From: "René 'Necoro' Neumann" <lists@necoro.eu>
To: zsh-users@zsh.org
Subject: Re: Local inner functions
Date: Thu, 24 Mar 2011 10:38:48 +0100	[thread overview]
Message-ID: <4D8B1128.2090405@necoro.eu> (raw)
In-Reply-To: <AANLkTinognOPQLV6xYNwuqJPJ=bHKs+AOM=suvz7MFY3@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

Am 24.03.2011 02:41, schrieb Bart Schaefer:
> On Wed, Mar 23, 2011 at 4:23 PM, René 'Necoro' Neumann
<lists@necoro.eu> 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é


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

  reply	other threads:[~2011-03-24  9:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 23:23 René 'Necoro' Neumann
2011-03-24  1:16 ` nix
2011-03-24  8:50   ` René 'Necoro' Neumann
2011-03-24  1:41 ` Bart Schaefer
2011-03-24  9:38   ` René 'Necoro' Neumann [this message]
2011-03-24 11:51     ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D8B1128.2090405@necoro.eu \
    --to=lists@necoro.eu \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).