Wow, interesting reading, thanks. So problem is not in "getting into" the
module, but instead in dynamic recompilation of dependencies inside that
module. Probably I should postpone my idea for future releases with that
issues resolved.

On Mon, Sep 8, 2014 at 1:23 AM, Isaiah Norton <isaiah.nor...@gmail.com>
wrote:

> Yes. The recommended work-around/workflow is to make changes within the
> module declaration, and call `reload` to get those changes. It's a similar
> issue to what is discussed here:
> https://github.com/JuliaLang/julia/issues/265
> (and could potentially be changed whenever that is resolved)
>
> This might also be useful or informative as an example:
> https://github.com/malmaud/Autoreload.jl
>
>
>
>
> On Sun, Sep 7, 2014 at 5:02 PM, Andrei Zh <faithlessfri...@gmail.com>
> wrote:
>
>> Thanks, Isaiah. Can you please add more details about closing Julia
>> modules? Is it like finalizing them so that no more details can be added to
>> it later? If so, what is rationale behind it?
>>
>> On Sunday, September 7, 2014 6:14:55 AM UTC+3, Isaiah wrote:
>>>
>>> I believe this is not currently exposed, although it may be worth
>>> pointing out that any internal variable from an imported module is readable
>>> with `MyModule.foo`. Julia modules are closed after declaration, although
>>> you can sort of cheat by calling `MyModule.eval(::Expr)  -- the downside
>>> being that the call will be interpreted.
>>>
>>> You could do a limited (read-only) form of this in a macro by basically
>>> checking all names in a macro against the current scope and then prepending
>>> `MyModule.X` if it is not found. I've wanted this occasionally, because it
>>> would make copy-pasting code from a module somewhat easier, for debugging
>>> purposes.
>>>
>>>
>>> On Fri, Sep 5, 2014 at 4:58 PM, Andrei <faithle...@gmail.com> wrote:
>>>
>>>> In module.c in Julia sources I see "jl_set_current_module()" function.
>>>> Is it somehow exposed to Julia API?
>>>>
>>>> To give you some context, in Common Lisp (as well as some other
>>>> dialects) there are 2 separate macros for dealing with packages (analogue
>>>> of modules in Julia):
>>>>
>>>>  defpackage - defines new package and switches to it
>>>>  in-package - simply switches to specified package
>>>>
>>>> One great feature that these macros bring is ability to easily switch
>>>> context of execution. E.g. in REPL (code simplified):
>>>>
>>>>  ;; initially working from cl-user package
>>>>  cl-user> (defpackage foo (:use :common-lisp)) ;; automatically
>>>> switched to new package
>>>>  foo> (defvar x 1)
>>>>  X
>>>>  foo> x
>>>>  1
>>>>  foo> (in-package :cl-user)
>>>>  foo> x
>>>>  ;; error: x not defined in :cl-user
>>>>
>>>> This is extremely helpful for both - package extension and
>>>> debugging/interactive development. E.g. we can switch to a module in
>>>> question and get all internal variables visible, play around in that
>>>> context and go back to main package without stopping REPL.
>>>>
>>>> So I'm wondering if something like this is possible in Julia at all.
>>>>
>>>
>>>
>

Reply via email to