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

Re: BUG: $_ empty on null function call



Peter Stephenson wrote on Mon, Feb 09, 2015 at 14:25:07 +0000:
> On Mon, 9 Feb 2015 14:10:26 +0000
> Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> > There are some other differences between anonymous functions, e.g., they
> > don't honor PRINT_EXIT_VALUE:
> > 
> > Engineering-wise, the ideal solution would be for anonymous and named
> > functions to share code... though I realize that may be a somewhat
> > invasive code change.
> 
> They already do everywhere that doesn't deal with the special argument
> syntax (Micah's problem) or with immediate execution after a definition.

Sorry, I know they have execshfunc() in common.  I was trying to suggest
that anonymous functions should start using execcmd(), which named
functions were using, in order to reuse its handling of $_ and
PRINT_EXIT_VALUE.

> I suspect this may have to do with a different path owing to an
> optimisation later in the execution path where we make certain
> assumptions if code is regarded as "simple".  This is inevitably a
> maintenance headache and we've had lots of issues there.
> 

For what it's worth, "() {} foo bar ; print $_" reproduces Micah's
problem and, both before and after your patch, doesn't go through
execsimple().

Cheers,

Daniel



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