This is where the distinction between “where it’s written” and “where it’s associated with/where the method belongs” lies. It’s written in that file, yes, but that doesn’t necessarily mean that it semantically belongs to that module. It’s similar to when you do
module B
# empty module
end
# Here B.C doesn't work
module A
using ..B
@eval B const C = 1
end
# After this, B.C works
You wouldn’t expect A.C to work, right? The same goes for ldlt of SuiteSparse.
No, because in you’re example you’re reexporting f from m2, which associates the name with m2 as well (and m1 of course already has f associated with it). This is not the case for SuiteSparse - the method is not reexported (the reason for which is possibly due to the method only being added conditionally).
The same goes for your submodule example. The submodule subm3 reexports f (which happens independently of being placed in m3) and thus has the name available, while m3 itself does not. It doesn’t know about any f (function or methods) at all - it only knows about the name subm3.