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

Re: Surprising parsing result with anonymous functions and for loops



On Thu, 25 Sep 2014 15:21:43 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> On 25 September 2014 13:39, Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> > On Thu, 25 Sep 2014 12:02:55 +0200
> > Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> >> Okay, but does anyone at least agree that doing alias expansion at
> >> that point is highly surprising?
> >
> > You mean regardless of function behaviour?
> >
> > % alias foo=bar
> > % for i in 1; do : ; done foo
> > zsh: parse error near `bar'
> 
> Ah, when i tested this i didn't realize it always happened, since i
> tested with my ls alias (so the error said `ls' regardless). So yes
> and no, it does happen regardless, but if you want to consider it a
> feature that () for a { echo $a } ls works, then my meaning was that
> it should at least print the exact arguments given.  :) ("you" in this
> case being Bart, not actually you). I have nothing intelligent to say
> about the rest of the mail except for nodding sagely while reading it,
> so I'll elide it.

I think the change is theoretically correct anyway; we shouldn't be
looking for commands at those points, we should only be looking for
arguments, even though only special arguments like redirections are
handled here, so actually it's moot for most non-error cases.

pws



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