Hi All,
I’m writing a module with a function that converts an internal DataType into a string.
However, without importing/exporting the DataType, the module name is added to the string.
Example:
module A
struct T1 end
function to_string()
s = T1()
return string(typeof(s))
end
end
julia> A.to_string()
"Main.A.T1"
julia> import .A.T1; A.to_string()
"T1"
In this example, is there a way for to_string() to return "T1" without importing or exporting T1 from module A?
Not sure. The code directly references T1, and it seems an unnecessary detour to put s = T1(); typeof(s), just to get back to T1. I guess @chiion needs to clarify.