Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Surprising parsing result with anonymous functions and for loops
- X-seq: zsh-workers 33239
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: Surprising parsing result with anonymous functions and for loops
- Date: Wed, 24 Sep 2014 22:53:01 -0700
- In-reply-to: <CAH+w=7ZOaTpcsQY+Kt5hnDr218LOfmz21Xp1-rZqnaD0zbS0Zg@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: <CAHYJk3SXb_hgz-abLaoLeU=U-Y0zwm=vHv-o+Oeg6=C3CedjUQ@mail.gmail.com> <20140924152625.73dfa6d9@pwslap01u.europe.root.pri> <CAHYJk3TR=EaB2yOTO_ZDGtnxrPatUNoj4CrG2SMy62vooLaUeA@mail.gmail.com> <CAH+w=7ZOaTpcsQY+Kt5hnDr218LOfmz21Xp1-rZqnaD0zbS0Zg@mail.gmail.com>
> The presence of braces around the entire body simply allows the parser
> to distinguish the body from the arguments. If there are other
> syntactic clues, those also distinguish body from arguments
Incidentally, I think this is related to zsh's non-standard handling
of redirections following a function definition. POSIX says that
foo() { echo foo; } >/tmp/foo
should behave the same as
foo() { { echo foo; } >/tmp/foo }
but in zsh it behaves like
{ foo() { echo foo; } } >/tmp/foo
Messages sorted by:
Reverse Date,
Date,
Thread,
Author