You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# See `?ClobberingReload.splitdef` for a better function-processing utility
152
-
:(function$name($(args...))
153
-
$counter[] +=1
154
-
$(body...)
155
-
end)
156
-
end
157
-
end
158
-
module_update() do
159
-
# Temporarily apply the update, for the duration of this do-block
160
-
AA.f(10)
161
-
end
162
-
AA.f(10)
163
-
164
-
println(counter[]) # 1
165
-
```
166
-
167
-
`update_code_revertible(some_function) do code ... end` works the same way, updating the code behind each of the methods of `some_function`.
168
-
169
-
This functionality is the basis of [TraceCalls.jl](https://github.com/cstjean/TraceCalls.jl). It's a hack, and can fail for any number of reason. Do not rely on this for mission-critical functionality.
170
-
171
-
Avoid storing the output of `update_code_revertible`, since if the files are modified
172
-
and reloaded by `creload` or `Revise.jl`, then the code-update object will be out-of-sync.
173
-
A better way to improve runtime is to memoize the result of the code transformation
0 commit comments