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

Re: PATCH: arguments to anonymous function



On Jun 19,  7:14pm, Peter Stephenson wrote:
}
} This adds arguments to anonymous functions.

Nice; one added remark:

} +Arguments to the function may be specified as words following the
} +closing brace defining the function, hence if there are none no
} +arguments (other than tt($0)) are set.  Note that this means
}  the argument list of any enclosing script or function is hidden.

A consequence of this is that the only real use for this syntax is to
pass along some of the positional parameters of the caller.  E.g.,

    function { print Caller arguments: "$@" } "$@"

Anything not referencing the caller's positionals can already be done
by using "set -- ..." as the first line of the anonymous function.



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