Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Local inner functions



> Hi all,
>
> I often use the construct of defining a function inside another
> function. Now I discovered, that these pour into the environment, i.e.
> if I have
>
> foo ()
> {
>    bar () { }
> }
>
> and I execute "foo", "bar" is now visible in my environment.
>
> Is there some way of making 'bar' to be local to 'foo'? Using the
> 'local' keyword does not work :).
>
> I know, that in principle it is possible to explicitly 'unfunction'
> functions, but this is not a usable way sometimes.
>
> Thanks for your help,
> René
>
>

I think localing is possibly only to variables as you know. What you're
trying to achieve by localing 'bar' inside 'foo'?





Messages sorted by: Reverse Date, Date, Thread, Author