diff options
| author | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-03-19 18:11:39 +0000 |
|---|---|---|
| committer | Daniel Shahaf <d.s@daniel.shahaf.name> | 2020-03-22 02:23:53 +0000 |
| commit | aed0cb4408bffe2da89a25054b22144f616bdffe (patch) | |
| tree | c9910a0e1ecc87187f3264b31189b098037178d0 /README | |
| parent | 45583/0008: Add the 'function -T' syntax. (diff) | |
| download | zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar.gz zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar.bz2 zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar.lz zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar.xz zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.tar.zst zsh-aed0cb4408bffe2da89a25054b22144f616bdffe.zip | |
45583/0009: Add end-of-options guard support to 'function -T'.
Diffstat (limited to 'README')
| -rw-r--r-- | README | 23 |
1 files changed, 17 insertions, 6 deletions
@@ -43,12 +43,23 @@ name of an external command. Now it may also be a shell function. Normal command word precedece rules apply, so if you have a function and a command with the same name, the function will be used. -The syntax "function -T { ... }" used to define a function named "-T". -It now defines an anonymous function with single-level tracing enabled --- -same as "function f { ... }; functions -T f; f", but without naming the -function. The syntax "function -T foo { ... }" is similarly affected: it -now defines a function "foo" with tracing enabled; previously it defined -two functions, named "-T" and "foo" (see the MULTI_FUNC_DEF option). +The "function" reserved word, used to define functions, gained a new -T option. +That affects syntaxes such as: + +1. "function -T { ... }". It used to define a function named "-T". It +now defines and executes an anonymous function with single-level tracing +enabled --- same as "function f { ... }; functions -T f; f", but without +naming the function. + +2. "function -T foo { ... }". It used to define two functions, named "-T" +and "foo" (see the MULTI_FUNC_DEF option). It now defines a function +"foo" with tracing enabled. + +3. "function -- { ... }". It used to define a function named "--". It +now defines and executes an anonymous function. The "--" is taken to be +an end-of-options guard (same as "ls --"). + +The sh-compatible function definition syntax, "f() { ... }", is unchanged. Incompatibilities since 5.7.1 ----------------------------- |
