In the document of Flux.jl an example of differentiation of implicit parameters is given as follows:

```
julia> x = [2, 1];
julia> y = [2, 0];
julia> gs = gradient(params(x, y)) do
f(x, y)
end
Grads(...)
julia> gs[x]
2-element Array{Int64,1}:
0
2
julia> gs[y]
2-element Array{Int64,1}:
0
-2
```

I just wonder how is this implemented. My main question is, how can we know what global variables does a function use?