I find this way of organizing my computing workflow interesting.
julia> CONFIG = (; S = nothing); # define this in the main module
julia> CONFIG === Main.CONFIG
true
julia> module My1 # my custom module 1
import ..CONFIG
const B = isnothing(CONFIG.S)
end;
julia> module My2 # my custom module 2 that should depend on `My1`
import ..My1
function f(x)
if My1.B
print("code_block_1")
else
print("code_block_2")
end
end
end;
julia> My2.f(0)
code_block_1
I wonder if the code_block_2 could be effectively removed during its compile time.
I also want to know if this is already a good design. (Now it reads pretty clear). (Note that I don’t aim to develop a “sourceless” package, e.g. to provide a function that takes all the necessary input data from the user).