Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: functions with redirections
- X-seq: zsh-workers 33291
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: functions with redirections
- Date: Tue, 30 Sep 2014 06:51:31 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SqshkLNheFYngUIxlBsBj92EBoJ7/CHiMb6hVjc8CNE=; b=x2s5E+yeT6RcAsccglQRtNLUh0qQimC8dRoJ1EXQYDfm0OAIftyc8R3U2dvsnYOVLi P6E6HnOpjWzgvNfiy62jWEdacRYNkD5ZXjhA1TNSNTX5z6eERujqOxt/YZh/KEmkluLf E7suGNgiYN6pB0rAwUtR4YNp6MY2EeAKwGMyTxPZ0E8N/+HIjlfqA26ZYAyvLP/Zb6R8 lV+0KbymuNR+OoRFy8Md/zEETEmeKChnqckO6WxZDAIrfjMDw5mEf1OzAmCLAVOA92JF kBZXBn2M/cnA7YPQFhFwP/5FgYmxveDIYN7gJtTU0QOxGaEuZvNSBYBSzXA2egf0JF5Y ZFEw==
- In-reply-to: <CAH+w=7Y=QjPSELAuXCGf_HoidypLt_3gNpfOi+RE419bSJkrng@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20140929205236.2eb5e622@pws-pc.ntlworld.com> <CAH+w=7ZzHKOQd8LCvdC+1gpCthb4Xd6t_8f9SjiXMssy=Vmn_g@mail.gmail.com> <CAH+w=7Y=QjPSELAuXCGf_HoidypLt_3gNpfOi+RE419bSJkrng@mail.gmail.com>
On 29 September 2014 23:37, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 29, 2014 1:53 PM, "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx> wrote:
>>
>>
>> On Sep 29, 2014 12:52 PM, "Peter Stephenson" <p.w.stephenson@xxxxxxxxxxxx>
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author