Our expression explorer uses the regular scope rules for structs. But structs are always global!
julia> let
struct x
end
end
julia> x
x
This has the correct behavior currently, which is that you can define struct in let block and other cells will work. and it will error when you try to re-define it. (although the error msg is a big weird: cannot assign a value to variable workspace9.x from module workspace22)
That's not the correct behavior: it shows an error message and redefining the struct is not reactive.
This test should pass:
@test testee(:(let struct a; b; c; end end), [], [], [], [
:a => ([], [], [], [])
])
here https://github.com/fonsp/Pluto.jl/blob/v0.11.14/test/ExpressionExplorer.jl#L31
@fonsp #527 Make the test above pass, but wondering what exactly is the expected behaviour in the notebook? I'm not quite sure that I'm understanding it correctly.
I would say that this is a bug in Julia, but we need to mirror Julia's scoping system, which is just confusing in this case.
Thanks for the fix!