Stream: helpdesk (published)

Topic: ✔ dependency on submodule of a package


view this post on Zulip Leandro Martínez (Aug 19 2022 at 17:06):

I have a package that contains a submodule. I can use that submodule directly, like:

using MyPackage.Submodule

Now, I want to use that submodule in another package, and thus this other package has MyPackage as a dependency. Until there, all fine.

However, this other package starts with:

module MyOtherPackage
    using MyPackage.Submodule
    ...
end

but I'm getting the Package MyOtherPackage does not have Submodule as a dependency error.

Is there a standard way to deal with this kind of issue? Having a submodule that essentially can be loaded independently is such an extraneous thing?

view this post on Zulip Leandro Martínez (Aug 19 2022 at 17:17):

Or, more simply. If I import MyPackage instead (I don't want to bring into scope the exported names of MyPackage):

module MyOtherPackage
    import MyPackage
    # how to bring into escope MyPackage.Submodule exported functions?
end

How can I then bring into scope the MyPackage.Submodule exported functions without making Submodule itself be interpreted as a directy dependency? Is there a workaround around that?

view this post on Zulip Leandro Martínez (Aug 19 2022 at 17:28):

Ok, this works:

module MyOtherPackage
    import MyPackage
    using .MyPackage.Submodule
    ...
end

view this post on Zulip Notification Bot (Aug 19 2022 at 17:29):

Leandro Martínez has marked this topic as resolved.


Last updated: Nov 06 2024 at 04:40 UTC