Skip to content

Commit 3c2200c

Browse files
authored
Fix missed comments from previous PR (#436)
1 parent df246e8 commit 3c2200c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/src/writing_good_rules.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ In fact, any number of scalar arguments is supported, as is returning a tuple of
231231
See docstrings for the comprehensive usage instructions.
232232

233233

234-
### Be careful about pullbacks closures calling other methods of themselves
234+
## Be careful about pullback closures calling other methods of themselves
235235

236236
Due to [JuliaLang/Julia#40990](https://github.com/JuliaLang/julia/issues/40990), a closure calling another (or the same) method of itself often comes out uninferable (and thus effectively type-unstable).
237-
This can be avoided by moving the pullback outside the function.
237+
This can be avoided by moving the pullback definition outside the function, so that it is no longer a closure.
238238
For example:
239239

240240
```julia
@@ -271,7 +271,7 @@ Body::Any
271271
```
272272
273273
This can be solved by moving the pullbacks outside the function so they are not closures, and thus to not run into this upstream issue.
274-
In this case that is fairly simple, since this example doesn't close over anything (if it did then would need a closure calling an outside function that calls itself).
274+
In this case that is fairly simple, since this example doesn't close over anything (if it did then would need a closure calling an outside function that calls itself. See [this example](https://github.com/JuliaDiff/ChainRules.jl/blob/773039a2dc0a1938f61cf26012b1223c942bc18f/src/rulesets/LinearAlgebra/structured.jl#L107-L116).).
275275
276276
```julia
277277
_double_it_pullback(ȳ::AbstractArray) = (NoTangent(), 2 .* ȳ)

0 commit comments

Comments
 (0)