File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ Get the innermost enclosing function object.
195195# Examples
196196
197197`@__FUNCTION__` is useful for closures that need to refer to themselves,
198- as otherwise the function object itself would be a variable and would be boxed:
198+ as otherwise the function object would be captured as a variable and boxed.
199199
200200```jldoctest
201201julia> function make_fib()
@@ -208,10 +208,10 @@ julia> make_fib()(7)
20820821
209209```
210210
211- If we had instead written `fib(n) = n <= 1 ? 1 : fib(n - 1) + fib(n - 2)`
212- for the closure function, `fib` would be treated as a variable, and be boxed .
211+ If we had instead used `fib(n - 1) + fib(n - 2)` directly, `fib` would be boxed,
212+ leading to type instabilities .
213213
214- Note that `@__FUNCTION__` is available for anonymous functions:
214+ Note that `@__FUNCTION__` is also available for anonymous functions:
215215
216216```jldoctest
217217julia> factorial = n -> n <= 1 ? 1 : n * (@__FUNCTION__)(n - 1);
@@ -220,7 +220,7 @@ julia> factorial(5)
220220120
221221```
222222
223- `@__FUNCTION__` can also be combined with `nameof` to get the symbol of the
223+ `@__FUNCTION__` can also be combined with `nameof` to get the symbol for an
224224enclosing function:
225225
226226```jldoctest
You can’t perform that action at this time.
0 commit comments