Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have extensions trigger from another extension getting loaded #48734

Open
KristofferC opened this issue Feb 20, 2023 · 3 comments
Open

Have extensions trigger from another extension getting loaded #48734

KristofferC opened this issue Feb 20, 2023 · 3 comments
Labels
feature Indicates new feature / enhancement requests packages Package management and loading

Comments

@KristofferC
Copy link
Member

A feature request regarding extensions (from @termi-official).

Being able to write:

[extensions]
ExtBase = [...]
ExtAdvanced = ["ExtBase", ...]

which would cause ExtAdvanced to be loaded if ExtBase (and the rest of the weak deps dependencies for it) are loaded. You should then be able to get a handle to ExtBase inside ExtAdvanced. This is so you can extend methods in the parent for types defined inside ExtBase.

@KristofferC KristofferC added packages Package management and loading feature Indicates new feature / enhancement requests labels Feb 20, 2023
@termi-official
Copy link

To give a more specific example to elaborate the specific use-case: I have some numerical package with works per default without MPI. The first extension provide the some basic MPI functionality, while the transient extension provides a bridge to specific solvers and matrix data types. However, since these bridges are rather small I think it would be better suited to have it as an extension instead of as separate packages.

@KristofferC
Copy link
Member Author

KristofferC commented May 19, 2023

I wonder if this isn't enough to solve this:

name = "Foo"

[extensions]
ExtBase = ["A", "B"]
ExtAdvanced = ["A", "B", "C"]

ExtAdvanced.jl:

module ExtAdvanced

using Foo, A, B, C
const ExtBase = Base.get_extension(Foo, :ExtBase)

# code

end

We would just have to make sure that ExtBase gets loaded before ExtAdvanced.

@termi-official
Copy link

This should also be fine, if there is an efficient way to do it and if it does not interfere with other requirements for extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Indicates new feature / enhancement requests packages Package management and loading
Projects
None yet
Development

No branches or pull requests

2 participants