How to avoid repeatedly calling include()?

I would think that you would include the file and then you may call the function, or am I misunderstanding something?

It may also be easiser, while you’re getting started with julia to not use modules and just share a namespace - multiple dispatch means you can reuse your own and base methods for new types, and namespace clashes are less important. The NameOfPackage.jl file is often the only module, and usually has all of the include statements in it in one place. Some packages use multiple modules, but often namespace boundaries occur only at the package level.

You will also find with julia, unlike some static languages, that you can call functions defined in later includes from earlier includes, so are freed from that kind of constraint and worrying too much about includes and where you can call functions - although types used in method signatures and inheritance need to be defined previously.

4 Likes