The following codes do the same thing:
module A
x = 3
end
@show A.x # 3
and
module A
x = 3
end
import .A
@show A.x # 3
Does import .A
do anything at all in the second example? If not, why is it allowed?
The following codes do the same thing:
module A
x = 3
end
@show A.x # 3
and
module A
x = 3
end
import .A
@show A.x # 3
Does import .A
do anything at all in the second example? If not, why is it allowed?
No, I think it does not nothing, as it is bringing to the scope a name that is already in the current scope.
I’m not sure if that is needed in any situation, maybe it is allowed because not allowing it would require a more complicated implementation of import in general. Do you see any important pitfall on allowing it?