I'm pretty sure include only works at the module scope, i.e. the global level of the module. But it should probably throw an error if used elsewhere, which it doesn't, and it should be documented.
On Sun, 2014-07-06 at 19:24, [email protected] wrote: > I'm not sure why it behaves differently inside the while loop, but I'm also > not sure how you can tell, since the function foo is already defined? > > Maybe you could explain what your goal is. `include` basically pastes the > included file at the call site. Why are you re-including the same file > multiple times? > > -- Leah > > > On Sun, Jul 6, 2014 at 2:48 AM, David A. <[email protected]> wrote: > >> For instance: >> >> #### file test_func.jl: >> >> function foo() >> println("This is foo") >> end >> >> >> #### file test.jl: >> >> include("test_func.jl") >> foo() >> timewait(f, 10; pollint=1.0) >> include("test_func.jl") >> foo() >> >> while true >> include("test_func.jl") >> foo() >> end >> >> >> >> Both foo() outside the while-loop work well reloading the function foo() >> from file test_func.jl , but the include inside the while-loop doesn't >> reload it. So I guess it's a matter of scopes. How to make an include >> inside a loop to reload it's contents as it does outside of loops? >> --
