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
julia>Module().String
ERROR: UndefVarError:`String` not defined in`Main.anonymous`
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name also exists in Base.
which I have seen trigger a few errors, such as
Failed to precompile VSCodeServer [9f5989ce-84fe-42d4-91ec-6a7a8d53ed0f] to "/home/serenity4/.julia/compiled/v1.13/VSCodeServer/jl_GTnvEA" (ProcessExited(1)).
WARNING: Detected access to binding `Private.private`in a world prior to its definition world.
Julia 1.12 has introduced more strict world age semantics forglobal bindings.
!!! This code may malfunction under Revise.
!!! This code will error in future versions of Julia.
Hint: Add an appropriate `invokelatest` around the access to this binding.
ERROR: LoadError: UndefVarError:`String` not defined in`VSCodeServer.JuliaInterpreter.var"#Internal".Private`
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name also exists in Base.
It seems like a world age issue:
julia>functionfails()
m =Module()
m.String
end
fails (generic function with 1 method)
julia>fails()
ERROR: UndefVarError:`String` not defined in`Main.anonymous`
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name also exists in Base.
Stacktrace:
[1] getproperty
@ ./Base_compiler.jl:48 [inlined]
[2] fails()
@ Main ./REPL[18]:3
[3] top-level scope
@ REPL[19]:1
[4] top-level scope
@ REPL:1
julia>functionworks()
m =Module()
@invokelatest m.String
end
works (generic function with 1 method)
julia>works()
String
julia> m =Module()
Main.anonymous
julia>names(m; all=true, usings=true)
1227-element Vector{Symbol}:
:!...
The text was updated successfully, but these errors were encountered:
My understanding is that it's relied upon a fair bit (Infiltrator.jl also does that for example, and I worked on an industrial codebase that did the same in the past), and so might be quite breaking in practice.
I agree - it's quite surprising to hear that calling a documented constructor in a local scope is invalid. Are modules only supposed to be created by the compiler/runtime, directly from parsed code? If this always was invalid due to Module being special, why does the language allow this in the first place?
In 1.11, we have
And on nightly:
which I have seen trigger a few errors, such as
It seems like a world age issue:
The text was updated successfully, but these errors were encountered: