Skip to content

Commit

Permalink
Concise info on creating and using a module without core and base (#4…
Browse files Browse the repository at this point in the history
…6628)

Co-authored-by: Jameson Nash <[email protected]>
  • Loading branch information
udohjeremiah and vtjnash authored Sep 12, 2022
1 parent 6f8e24c commit 7eacf1b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion doc/src/manual/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,17 @@ include(p) = Base.include(Mod, p)
end
```

If even `Core` is not wanted, a module that imports nothing and defines no names at all can be defined with `Module(:YourNameHere, false, false)` and code can be evaluated into it with [`@eval`](@ref) or [`Core.eval`](@ref).
If even `Core` is not wanted, a module that imports nothing and defines no names at all can be defined with `Module(:YourNameHere, false, false)` and code can be evaluated into it with [`@eval`](@ref) or [`Core.eval`](@ref):
```jldoctest
julia> arithmetic = Module(:arithmetic, false, false)
Main.arithmetic
julia> @eval arithmetic add(x, y) = $(+)(x, y)
add (generic function with 1 method)
julia> arithmetic.add(12, 13)
25
```

### Standard modules

Expand Down

0 comments on commit 7eacf1b

Please sign in to comment.