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

Re: r/w access to calling function's $@



On May 13,  5:13pm, Peter Stephenson wrote:
}
} Passing back values has always been one of my chief annoyances about
} shell functions, nor do I think generically allowing references to
} higher level parameters is a good idea.  We need something more
} specific that I haven't thought of to do parameter references.
} 
} (While I've been distracting you, Bart will meanwhile have thought
} of a way of doing it.)

No such luck this time.  You can do it with the "trap" command or a
parameter declared "local" if the caller cooperates, but you can't do
it all from inside the called function.

I believe ksh namerefs can reach across scopes this way, but you still
have to declare the nameref in the outer scope, and zsh doesn't have
real namerefs yet in any case.

Of course the "standard" way to do this is to use the $reply array or
the $REPLY scalar, which are semi-reserved names for the purpose.



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