From: Mikael Magnusson <mikachu@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: PATCH: functions with redirections
Date: Tue, 30 Sep 2014 06:51:31 +0200 [thread overview]
Message-ID: <CAHYJk3QwugW9a7-rH4-6RXrkomvX3QOrS1TzzDZy7W4+NPOs_Q@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Y=QjPSELAuXCGf_HoidypLt_3gNpfOi+RE419bSJkrng@mail.gmail.com>
On 29 September 2014 23:37, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sep 29, 2014 1:53 PM, "Bart Schaefer" <schaefer@brasslantern.com> wrote:
>>
>>
>> On Sep 29, 2014 12:52 PM, "Peter Stephenson" <p.w.stephenson@ntlworld.com>
> wrote:
>> >
>> > I haven't yet looked at dump files. That's partly becuase I don't
>> > understand them and partly because I don't use them. Any hints would be
>> > great.
>>
>> By dump files do you mean zcompile?
>> I fear I'm not of much help there.
>
> A thought:
>
> My first idea when this came up was to alter the wordcode for functions
> with redirections to explicitly add the implicit set of braces, e.g.,
>
> foo () { echo foo } >&3
>
> becomes
>
> foo () { { echo foo } >&3 }
>
> Then it would not be necessary to mess with printing/dumping etc. of the
> definition, or invent a new place to store the redirections. Yeah, output
> of "functions" et al. becomes a little less faithful but so what?
>
> Sadly I never managed to make that work, but maybe the concept is helpful
> for dump file creation.
I noticed that the contents of $functions[foo] in the former case
completely omits the redirection as it is currently. An argument for
turning the syntax into the latter is that you could claim it wasn't a
function definition of the form foo() { ... } in the first place, but
a foo() ... definition, where ... happens to be { xyz } > &3 which is
also a valid single statement command, printing the function in a
normalized form would then tack on the outer braces as usual. I don't
know if this would hold up in court though.
--
Mikael Magnusson
next prev parent reply other threads:[~2014-09-30 4:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-29 19:52 Peter Stephenson
2014-09-29 20:27 ` Peter Stephenson
2014-09-29 20:53 ` Bart Schaefer
2014-09-29 21:37 ` Bart Schaefer
2014-09-30 4:51 ` Mikael Magnusson [this message]
2014-10-01 19:17 ` Peter Stephenson
2014-10-02 4:07 ` Bart Schaefer
2014-10-02 8:35 ` Peter Stephenson
2014-10-02 14:55 ` Peter Stephenson
2014-10-02 15:54 ` Bart Schaefer
2014-10-02 15:56 ` Bart Schaefer
2014-10-02 16:03 ` Peter Stephenson
2014-09-30 1:02 ` Bart Schaefer
2014-09-30 8:48 ` Peter Stephenson
2014-09-30 11:52 ` Peter Stephenson
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=CAHYJk3QwugW9a7-rH4-6RXrkomvX3QOrS1TzzDZy7W4+NPOs_Q@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@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).