[ANN] PatModules.jl: a better module system for Julia

The issue is not double inclusion, but the inclusion order. This can cause a lot mental burden and should be handled by the compiler since the compiler knows which module depends on which, e.g when you have

include("B.jl")
include("A.jl")

where module B depends on A, manual include will result in undefined error, but if we implement issue 4600, then we can just write something like (the syntax is not decided yet)

using .B from "B.jl"
using .A from "A.jl"

or

using .A from "A.jl"
using .B from "B.jl"

the order does not matter anymore, since the compiler will evaluate module A when loading B. The include order problem is something the programmer should not and do not need to care about - the compiler has sufficient information to infer that, now using manual include just increases the programmers’ burden.


I don’t think relative module loading is something that is not encouraged, and in fact I believe file loading should be handled by compiler, the programmers should not take care about the orders and dependencies of files themselves - if it’s something the machine can easily do why are we humans doing it?

6 Likes