The easier part first. Here an example for the different ways to query namespaces and structures
# For modules
@show isdefined(Main, :sin)
@show isdefined(Main, :tin)
@show getproperty(Main, :sin)
# For structs
struct Example
d
Example() = new()
Example(d) = new(d)
end
e = Example()
@show hasproperty(e, :d)
@show isdefined(e, :d)
# @show getproperty(e, :d) #fails
e = Example(42)
@show hasproperty(e, :d)
@show isdefined(e, :d)
@show getproperty(e, :d)
yielding
isdefined(Main, :sin) = true
isdefined(Main, :tin) = false
getproperty(Main, :sin) = sin
hasproperty(e, :d) = true
isdefined(e, :d) = false
hasproperty(e, :d) = true
isdefined(e, :d) = true
getproperty(e, :d) = 42
For the second part:
I’ve got somewhat accustomed to it. Do you have a better idea?