From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: r/w access to calling function's $@
Date: Tue, 13 May 2014 17:13:21 +0100 [thread overview]
Message-ID: <20140513171321.03294b76@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20140513160140.GC1629@isis.sigpipe.cz>
On Tue, 13 May 2014 18:01:40 +0200
Roman Neuhauser <neuhauser@sigpipe.cz> wrote:
> zparseopts can modify $@ in the calling scope. i'm playing with my own,
> slightly different option parser. what do i have to do to get access to
> this feature?
The trick is it's not a different scope, it's just a builtin within the
current function scope. The equivalent would be to implement your own C
plugin, which I presume is not what you're after. Failing that you
have to do something nasty like using "eval" to avoid exposing the
point where it gets transferred to the current argument set.
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.)
pws
next prev parent reply other threads:[~2014-05-13 16:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-13 16:01 Roman Neuhauser
2014-05-13 16:13 ` Peter Stephenson [this message]
2014-05-13 16:42 ` Roman Neuhauser
2014-05-13 16:58 ` Peter Stephenson
2014-05-13 16:43 ` Bart Schaefer
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=20140513171321.03294b76@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--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).