Closed lassepe closed 3 years ago
Merging #30 (a3e7e23) into master (3ab612e) will increase coverage by
14.28%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #30 +/- ##
============================================
+ Coverage 85.71% 100.00% +14.28%
============================================
Files 1 1
Lines 14 20 +6
============================================
+ Hits 12 20 +8
+ Misses 2 0 -2
Impacted Files | Coverage Δ | |
---|---|---|
src/Reexport.jl | 100.00% <100.00%> (+14.28%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 3ab612e...a3e7e23. Read the comment docs.
Should I also add some examples to the README?
I've leave that up to you whether you want to add some examples. Examples are great but I'm also fine accepting this PR as-is.
Okay cool. Please don't merge this yet. I think I found another edge-case regarding for import Foo: bar
. Currently, only import Foo.bar
is supported
Another thing that I am wondering: What is the desired behavior of @reexport import Foo
. Currently it only exports Foo
not the names within. In my opinion this is the correct behavior because import Foo
also only adds Foo
to the current namespace. Or should it be disallowed?
I added examples to the README and also handled @reexport import Foo: bar
. As for @reexport import Foo
I think the behavior of not exporting any of Foo's names is correct, so I did not change that. Thus, from my side this would be ready for another review.
In my opinion this is the correct behavior because
import Foo
also only addsFoo
to the current namespace.
I agree 👍
Great work and thanks for your patience with my review 😄
Thank you for the detailed review! It's my first time meta programming so it's good to get a lot of feedback :)
This pull-request is an attempt to make Reexport composable with other import macros. This idea originated from https://github.com/Roger-luo/FromFile.jl/issues/25
In order to facilitate compatibility with FromFile.jl (and potentially other import macro tools) this PR introduces the following change:
Base.macroexpand
, thus@reexport
always sees the code as if all the syntax transformations have been written out@reexport
recursively expands all:block
expressions (since macros likeFromFile.@from
return a block of multiple import statements)@reexport import A.b
and@reexport import A: b
which are transformed toimport A.b; export b
andimport A: b; export b
respectively.Please let me know what you think about this proposal. I will add tests, once we've worked out if we want this feature at all. Also, please let me know if you prefer this pull quest to be split up into multiple smaller ones.
Edit:
The feature number 2 above has the nice side-effect that you can now wrap an entire block in a
@reexport
macro: