-
Notifications
You must be signed in to change notification settings - Fork 55
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
Wrap everything in a version check #21
Conversation
This still defines a My thinking was that the entire |
Yes, I was thinking about branching the package and keeping an (almost) empty package just for Julia 0.6. |
I guess you could also do: if VERSION < ....
import Base.FFTW
else
__precompile__(true)
module FFTW
....
end
end if you don't want to mess with multiple branches/versions of REQUIRE. |
Or perhaps if VERSION < ....
import Base.FFTW
else
include("src.jl") # defines module FFTW
end so that 0.6 doesn't pay the price of parsing the whole (This way the diff will also be small, since you will just do |
daba494
to
8ebc2a3
Compare
The fact that wrapping the AbstractFFTs imports was necessary is a little concerning. Perhaps we need to do something similar there but with Base.DFT? |
test/runtests.jl
Outdated
importall FFTW | ||
import AbstractFFTs: Plan, fft, ifft, bfft, fft!, ifft!, bfft!, | ||
if VERSION >= v"0.7.0-DEV.602" | ||
import AbstractFFTs: Plan, fft, ifft, bfft, fft!, ifft!, bfft!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't using AbstractFFTs
be enough here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(except for Plan
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, to avoid name conflicts, AbstractFFTs only exports things if none of the functions are defined in Base. So using AbstractFFTs
won't import anything into Main until after the deprecation period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really annoying. I feel like we should make it possible to override a deprecated binding without a warning (precisely for things like this … it's going to be a continual annoyance to move things out of Base otherwise)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same thing we did with Primes and continue to do with SpecialFunctions, QuadGK, the priority queue stuff in DataStructures, etc. It's certainly not ideal. Being able to do that would make it easier to fully support multiple versions at once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And actually, it seems that @deprecate
doesn't call deprecate
either.... only @deprecate_binding
uses it. (This seems correct: @deprecate
may not deprecate a whole function: it may only deprecate certain methods.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually legit to deprecate in Main though? What happens to packages then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, the code above relied on patching Julia as well to check for the deprecation before emitting a warning message:
--- a/src/module.c
+++ b/src/module.c
@@ -190,7 +190,7 @@ static jl_binding_t *jl_get_binding_(jl_module_t *m, jl_sym_t *var, modstack_t *
if (tempb == NULL || tempb->owner == NULL)
// couldn't resolve; try next using (see issue #6105)
continue;
- if (owner != NULL && tempb->owner != b->owner &&
+ if (owner != NULL && tempb->owner != b->owner && !tempb->deprecated &&
!(tempb->constp && tempb->value && b->constp && b->value == tempb->value)) {
jl_printf(JL_STDERR,
"WARNING: both %s and %s export \"%s\"; uses of it in module %s must be qualified\n",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully I'll have a PR for Julia shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be awesome!
test/runtests.jl
Outdated
fftshift, ifftshift, plan_inv | ||
import FFTW: fftw_vendor | ||
else | ||
import Base.DFT: Plan, fft, ifft, bfft, fft!, ifft!, bfft!, | ||
plan_fft, plan_ifft, plan_bfft, plan_fft!, plan_ifft!, plan_bfft!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, why do you need to import plan_fft
in 0.6, since that is already exported? The only thing here that is not exported in 0.6 is Plan
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied and pasted, but originally I had tried with just Plan
but there was something else it was getting mad about (can't recall what it was offhand, plan_
something or other)
end | ||
|
||
# MKL provides its own FFTW | ||
fftw_vendor() = Base.BLAS.vendor() === :mkl ? :mkl : :fftw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this function just be called vendor()
, with a qualified name of FFTW.vendor()
analogous to BLAS.vendor()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The name is a carryover from Base.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with a @deprecate fftw_vendor
definition, of course.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right
I tried |
Can fix it by changing |
I think that gets back to the fact that neither this package nor AbstractFFTs exports anything when the names are defined in Base... |
03c299e
to
bab0bd6
Compare
bab0bd6
to
4929524
Compare
1389901
to
f1fbc3c
Compare
f1fbc3c
to
feb7c5f
Compare
Since this gets things working on 0.6 I think we should just go ahead and merge this and I'll continue to try to get 0.7 working in separate PRs. |
(Actually let's wait until Compat is fixed) (side note, I hate that I had to add Compat) |
Actually the fix was wrong in Compat so this should be fine. |
The diff looks a little weird, but this just wraps the contents of src/FFTW.jl with