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 12:20:42 +0000:
> On Mon, 9 Feb 2015 03:38:58 -0800
> Micah Waddoups <micah@xxxxxxxxxxxx> wrote:
> >    I am still a beginner in developing, or I would tackle this issue 
> > directly myself.  The misbehavior is when the command list has a null 
> > function with parameters, the last-command-last-parameter ($_) built-in 
> > variable goes blank.
> 
> Yes, that's obviously an oversight internally.  $_ simply isn't handled
> on this path.
> 

There are some other differences between anonymous functions, e.g., they
don't honor PRINT_EXIT_VALUE:

    % setopt printexitvalue
    % () false

v.

    % setopt printexitvalue
    % f() false
    % f                                                            
    zsh: exit 1

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.

Daniel

> Somebody will get around to it eventually, I imagine...
> 
> pws



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