Skip to content

load behaviour is different with/without begin...end #44104

@Roger-luo

Description

@Roger-luo

I come originally from https://discourse.julialang.org/t/from-from-fromfile-does-not-work-inside-begin-en-for-local-module-workflow/76100/2

MWE

julia> begin
       using LinearAlgebra
       LinearAlgebra.@commutative
       end
ERROR: LoadError: UndefVarError: LinearAlgebra not defined
in expression starting at REPL[1]:3

I think Pluto users put every commands inside begin ... end so this should be considered equivalent to have the following directly in REPL

using LinearAlgebra
LinearAlgebra.@commutative

I'm not sure why the module followed with a macro is somehow evaluated before the module is loaded? I think most people would expect this to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions