Open amitmurthy opened 9 years ago
Thinking about this revealed how fuzzy I am on the module system. Modules seem to be objects. For example, a==b
works for two modules a and b. But if I have two modules in different processes, what makes them the "same"? The path of names to reach them? Also, just for serial code, is there a way to "inject" evaluation of an expression into a module, or is that a meaningless question?
For the second question: I belive that eval(MyModule, expr
) should work, maybe also MyModule.eval(expr)
.
@ArchRobison The only built-in notion of 'sameness' for modules is if the two module instances are "==="; ie have the same memory address. Each invocation of module X ... end
will create a new module object, so module equality has nothing to do with the name of the module.
Related:
julia> module M
x=1
y=@fetch x+1
end
WARNING: Module M not defined on process 2
fatal error on 2: ERROR: UndefVarError: M not defined
Consider the following:
This is because
foo()
creates X as module global, while the@everywhere
call refers toMain
Would it be appropriate to have the remote part of all parallel methods execute under the same module as the calling module? Is information about the calling module available to a function in Base?