simonster / Reexport.jl

Julia macro for re-exporting one module from another
Other
161 stars 19 forks source link

Extending methods after reexporting #7

Closed juliohm closed 7 years ago

juliohm commented 7 years ago

We recently split off the morphological operations of Images.jl into a separate package: https://github.com/JuliaImages/ImageMorphology.jl

We use Reexport in Images.jl, but we want to extend some methods inside of ImageMorphology.jl for arbitrary image metadata, not just arrays. When I do:

@reexport using ImageMophology

and try to extend:

# extend method for ImageMeta type
dilate(img::ImageMeta, ...) = ...

The definition of dilate for raw arrays seems to go away when I later try to use Images.jl. Could you please explain how to solve this issue?

juliohm commented 7 years ago

@timholy what am I missing here? Do you have suggestions on how to solve this issue?

timholy commented 7 years ago

Don't have you have say import dilate to extend the method? Or use ImageMorphology.dilate(...

juliohm commented 7 years ago

We have to do this manually for each symbol we want to extend? I was thinking Reexport had another solution for that, I will see if it works :+1:

timholy commented 7 years ago

No, it just means you don't have to list all the methods of the package in an export statement; it doesn't have anything to do with adding specializations.

juliohm commented 7 years ago

Problem solved :)