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

Describe how to export downstream #21

Open
mmikhasenko opened this issue Oct 5, 2024 · 4 comments
Open

Describe how to export downstream #21

mmikhasenko opened this issue Oct 5, 2024 · 4 comments
Assignees

Comments

@mmikhasenko
Copy link
Member

mmikhasenko commented Oct 5, 2024

Here is what I do in FourVectors.jl

# Access the list of function names
const ALL_GETTER_FUNCTIONS = vcat(
    collect(LorentzVectorBase.FOURMOMENTUM_GETTER_FUNCTIONS),
    collect(keys(LorentzVectorBase.FOURMOMENTUM_GETTER_ALIASSES)),
)

# Loop over each function name and import and export it
for func_sym in ALL_GETTER_FUNCTIONS
    # Import the function from LorentzVectorBase
    @eval import LorentzVectorBase: $(func_sym)
    # Export the function from this module
    @eval export $(func_sym)
end
@Moelf
Copy link
Member

Moelf commented Oct 5, 2024

@mmikhasenko
Copy link
Member Author

I do not think you want to list all methods and their aliases manually.
How do you mean using @reexport ?

@szabo137
Copy link
Member

szabo137 commented Oct 8, 2024

I think it is not a good idea to (re)export every getter function. Currently, we've decided to use short names like x,y,z,t,E,px,..., which can mess up the namespace for all packages with using FourVectors.jl.

To have a better exportability of the getter functions, we must rename them, e.g. x->x_component, so x_component can be safely exported.

@szabo137
Copy link
Member

szabo137 commented Oct 8, 2024

I do not think you want to list all methods and their aliases manually. How do you mean using @reexport ?

The @reexport macro just grabs all exports of one package (e.g. LorentzVectorBase) and exports them again on a depending package (e.g. FourVectors.jl). However, since in the current status, LorentzVectorBase.jldoes not export the getter functions (because of the reason above),@reexport` will not help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants