I'm using Julia 0.4.0 on Mac OS X 10.10.5. I'd like to put some code into a
module, but I'm having some trouble with namespaces. The following fails
(`UndefVarError: test.a not defined`) when enclosed inside `module test`.
When outside the module, e.g. pasted into the REPL, the code works fine.
Could someone point me to relevant reading material or explain what is
going on? It seems I can avoid the problem by putting the string "a" in
the dictionary instead of the abstract type, but I want to know why I am
unable to do things as written. Thank you for your patience as I am new to
the language.
module test
abstract a
dict = Dict("key" => a)
function createType(typeName::ASCIIString,supertype::DataType)
typeSymb = symbol(typeName)
superSymb = symbol(supertype)
@eval immutable ($typeSymb){T} <: $superSymb
num::Float64
end
end
createType("b",dict["key"])
end