November 2016
Intermediate to advanced
697 pages
14h 44m
English
The code of Julia packages (also called libraries) is contained in a module, whose name starts with an uppercase letter by convention like this:
# see the code in Chapter 6\modules.jl
module Package1
# code
endThis serves to separate all its definitions from those in the other modules, so that no name conflicts occur. Name conflicts are solved by qualifying the function by the module name. For example, the packages Winston and Gadfly both contain a function plot. If needed these two versions in the same script, we would write this as follows:
import Winston import Gadfly Winston.plot(rand(4)) Gadfly.plot(x=[1:10], y=rand(10))
All variables defined in the global scope are automatically added to the Main module. Thus, when ...
Read now
Unlock full access