Just two simple questions. I come to Julia with an understanding of scope in other languages, but…
This table from the manual suggests the REPL has its own global scope. Whereas I’d thought the REPL executes in the scope of module
Main, already in the table. Just a poorly worded table?
Yet after puzzling over this, what I’m trying now to convince myself of is why doesn’t the REPL have its own scope, a local scope nested in global scope
Main. (i.e. why doesn’t REPL initialization loosely speaking just tell the interpreter it’s in global scope
Main, local scope
Repl before kicking off read-eval-print loop) I don’t believe I’m speaking of
An obstacle I saw mentioned is that the function
eval evaluates in the global scope of the containing module, so not in this hypothetical local scope
Repl. But, seriously, then why must the REPL use
eval instead of an alternative new function that evaluates in the local scope it’s told to? What are the technical difficulties, if someone well acquainted may summarize?
I don’t know if this requires @jeff.bezanson to explain, as an interpreting issue, but the difficulties must be great indeed, judging by the extensive effort to create alternate scope semantics in the REPL when all it really wants is to be local scope.
Thanks in advance for the education–what am I missing?