# Why doesn't this "include-guard-ish" code evaluate in the correct order?

**URL:** https://discourse.julialang.org/t/why-doesnt-this-include-guard-ish-code-evaluate-in-the-correct-order/93108
**Category:** New to Julia
**Tags:** scripting
**Created:** [January 17, 2023, 6:29pm UTC](https://discourse.julialang.org/t/why-doesnt-this-include-guard-ish-code-evaluate-in-the-correct-order/93108 "2023-01-17T18:29:33Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)
#### Post date: [January 18, 2023, 12:35pm UTC](https://discourse.julialang.org/t/why-doesnt-this-include-guard-ish-code-evaluate-in-the-correct-order/93108/5 "2023-01-18T12:35:18Z")

</div>

C++ compiler vendors are still struggling to implement C++20 modules in 2023, and here you are in Julia, trying to use `include`s instead.

I strongly suggest putting this code into modules.  
You can then `using` the module as many times as you’d like; the header-guards are built in.  
The module will also be precompilable.

To put these in a load path, I’d put them in a package and `] dev` it. Creating packages is easy with:

> **[GitHub - JuliaCI/PkgTemplates.jl: Create new Julia packages, the easy way](https://github.com/JuliaCI/PkgTemplates.jl)**
>
> Create new Julia packages, the easy way. Contribute to JuliaCI/PkgTemplates.jl development by creating an account on GitHub.

You could create one package for each of `common`, `constants`, etc. Or one package with multiple modules, if that’s what you’d prefer.

Either way, I’d definitely use modules instead of trying to use header guards. That’s why we have them, and why languages like C++ are trying to transition to them.

EDIT:  
I also avoid the PktTemplates wizard, because it is nice to be able to just hit up in the search history and get a generic template. E.g., typing `t = PkgT` and hitting up, I get:

```julia
t = PkgTemplates.Template(user="chriselrod",plugins=[Git(ignore=["*#*", "*~", "*#*#"],branch="main",ssh=true),CompatHelper(),GitHubActions(),Codecov(),Documenter{GitHubActions}()]);
PkgTemplates.generate(t, "MyNewPkgName") # PkgT [up]

```

Most people will probably want to use a different `user=`.

So creating a new package only takes me a few seconds. The skeleton is all there, so all that’s left is `dev`ing it and filling out the code.

---

_[View the full topic](https://discourse.julialang.org/t/why-doesnt-this-include-guard-ish-code-evaluate-in-the-correct-order/93108)._
