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

**URL:** <https://discourse.julialang.org/t/ann-patmodules-jl-a-better-module-system-for-julia/52226>\
**Category:** Package Announcements\
**Tags:** code-organization\
**Created:** [December 22, 2020, 1:09pm UTC](https://discourse.julialang.org/t/ann-patmodules-jl-a-better-module-system-for-julia/52226 "2020-12-22T13:09:19Z")\
**Posts on this page:** 1\
**Showing post:** 63

<div class="post-metadata">

**Author:** ![Roger-luo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roger-luo/32/3399_2.png) [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Post date:** [December 28, 2020, 12:50am UTC](https://discourse.julialang.org/t/ann-patmodules-jl-a-better-module-system-for-julia/52226/63 "2020-12-28T00:50:48Z")

</div>

> [@MA\_Laforge](#):
>
> That means you can _ **guarantee** _ there is no double inclusion because you, as the developer, have control over this entire project/package codebase. Moreover, your code files need _ **only** _ be included once (it is not the same thing as C/C++ headers). That’s why you’ve noticed people often `include()` a bunch of subfiles from the same master file. Once `include()` -ed, that code is available to _ **any other module** _ loaded by Julia (There is no information hiding like there is in C/C++).

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

```julia
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)

```julia
using .B from "B.jl"
using .A from "A.jl"

```

or

```julia
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?

---

_[View the full topic](https://discourse.julialang.org/t/ann-patmodules-jl-a-better-module-system-for-julia/52226)._
