Re: [julia-users] Re: Module Includes Problem
I wish this had been clearer from the start. My problem with *include* from the beginning was that it always seemed to require the full path of the file and when you're trying to write something for others with different paths this is impractical. *require* would seem to find it without the full path. Ever since I learned about LOAD_PATH and how to add to it I've discovered that *include* will also check there and that modules have issues with *require* so I'll switch them all over to *include*s. Finally the *include*s don't need the full path because of the LOAD_PATH updates. My takeaway from all of this is that I should use includes in functions and modules. Should I only use *require* for loading common functions into Julia in the .juliarc.jl file? Thanks for all the help.
Re: [julia-users] Re: Module Includes Problem
Great! I'm glad it works. :) As Ivar said, you should keep in mind the difference between `require` and `include`. Defaulting to using `include` inside module definitions should avoid this kind of problem in the future. On Mon, Sep 15, 2014 at 3:35 PM, Ivar Nesje wrote: > If dirlist.jl declares a module, you might have to use the full name > `YourModule.dirlist`. Another potential gotcha is that require() only will > load the file once, and when you're inside a module definition you might > want to include() the file so that it will be loaded multiple times in the > same session, or define a package you can be `using` instead. > On Tue, Sep 16, 2014 at 8:50 AM, RecentConvert wrote: > include("O:\\Code\\Julia\\dirlist.jl") does ineed work > > dirlist.jl does not call or define any modules >
Re: [julia-users] Re: Module Includes Problem
include("O:\\Code\\Julia\\dirlist.jl") does ineed work dirlist.jl does not call or define any modules
Re: [julia-users] Re: Module Includes Problem
1) Have you tried changing the `require("dirlist.jl")` inside module Aerodyne to `include("dirlist.jl")`? If so, what happened? 2) If that didn't work, does dirlist.jl define any modules? -- Leah On Tue, Sep 16, 2014 at 4:46 AM, RecentConvert wrote: > My .juliarc.jl file has three sections: the first adds any paths to > LOAD_PATH, the second loads common modules including the Aerodyne one I am > having issues with, and the final one is a list of requires of common > functions I use including dirlist.jl. Aerodyne does call it earlier as a > require when it is loaded as well. > > # 3 methods for generic function "dirlist": > dirlist() at O:\Code\Julia\dirlist.jl:11 > dirlist(directory::ASCIIString) at O:\Code\Julia\dirlist.jl:32 > dirlist(directories::Array{ASCIIString,1}) at O:\Code\Julia\dirlist.jl:36 >