Open
Description
openedon Aug 29, 2023
Unpacking inside the function assigns into the parent scope; unpacking in the arglist binds a new variable. Should I expect that from something in https://docs.julialang.org/en/v1/manual/variables-and-scoping/ or is that arglist-unpacking a special behavior?
let x = 1
function f(θ)
(;x) = θ
end
θ₀ = (;x=2)
@show x # 1
f(θ₀)
@show x # 2
end
let x = 1
function f((;x))
end
θ₀ = (;x=2)
@show x # 1
f(θ₀)
@show x # 1
end
That's on 1.9.1.
@CameronBieganek says both give 1
then 2
on 1.8.2, implying the behavior changed.
I'm not sure what's supposed to happen here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment