Fortran modules can be used to pass variables “behind” the main program, so that one can pass arguments to functions which are called by third-party codes without changing their arguments. For example:
module Test double precision :: a end module Test program Main use Test a = 2. x0 = 10. ! Initial guess fmin = minimizef(x0) end program Main function f(x) use Test f = a*x^2 ! The parameter "a" was declared in the module and modified in Main end function f function minimizef(x) some code that calls a function in the form f(x), and I don't want to modify this code, which might be an optimized routine written by someone else. end function minimizef
How can I deal with a similar situation in Julia? Apparently I could define a module, but the “using” keyword puts the variables of the module in the global scope, which is not the same thing.
I am probably not getting the logic of Julia programming quite correctly. Probably there is a natural way to deal with such situations which I am not used to.