Use of Module, Vector and Matrix in Main


#1

We are currently developing a new commutative algebra package (called Singular.jl) for which modules, vectors and matrices are of central importance. We defined Module, Vector and Matrix in our Singular module, with the realisation that these are defined elsewhere in Julia and that we need to disambiguate their use with Singular.Module, etc.

On the face of it, this seems to be fine, since anyone who uses Singular.jl, who tries to use Vector, Matrix or Module gets a warning that both Main and Singular define these and they must disambiguate. And this is precisely what we intended. It’s only ever an issue for someone who is using our package, and we figured having them type Singular.Module wasn’t a burden.

The problem is, when we tab complete in the REPL, all three of these are used by some other package (not sure which), without prefixing the module (Main).

But I’m not sure why this is even happening. Which module within Julia is using Singular and Main? (My guess is Main itself?? Though I am not sure where such functions are defined.)

Would it be feasible to disambiguate in whichever module it is that uses these, so that we don’t get a warning for all three symbols when tab completing? We are happy to prepare the PR if this is considered feasible and not too much of a nuisance. Singular.jl is unlikely to be used for anything general purpose. It’s a very specialised package. However, I am sure this affects other packages that want to use these names.


#2

Actually, I have just realised that this is not specific to Vector, Module and Main. If a module defines any symbol which is already defined in (presumably Base or) Main then everything is fine until someone tries to do any kind of tab completion.

Somehow, the mere act of tab completing leads the system to print a warning message about the use of that symbol in both Main and the new module.

Is this considered a bug?


#3

Yes, this is a bug. It has nothing to do with Main or symbols defined by Julia. It happens even for two user defined modules for totally random symbols that have nothing to do with Julia. I will check this happens with the latest nightly and open a ticket.


#4

Why do you export these types?


#5

To be honest, I don’t actually know what export does. But would it be safe to assume that some other module is going to export them for us and that this will never change?


#6

It doesn’t matter because your API will be to use Singular.Vector which will work anyway.