-
Notifications
You must be signed in to change notification settings - Fork 50
Conversation
Rewrite broadcast as generated function to avoid world age problems. Use some of the broadcast functionality in Base. Update getindex and setindex to Base changes. Use generated functions instead of @nsplat. Use some of the Base machinery for getindex Fix many syntax deprecations
deprecation warning
Oh, and I can see that my build of Julia has become obsolete while finishing the PR. |
src/DataArrays.jl
Outdated
@@ -1,14 +1,14 @@ | |||
__precompile__() | |||
__precompile__(false) |
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.
What's keeping from being able to precompile?
src/broadcast.jl
Outdated
$(Symbol("pool_$(k)")) = $(Symbol("A_$(k)")).pool | ||
end : nothing | ||
for k = 1:narrays]...)) | ||
Base.map!{F}(f::F, B::Union{DataArray, PooledDataArray}, A0::AbstractArray, As::AbstractArray...) = |
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 the typevar necessary 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.
yes, otherwise it won't specialize on the function
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.
Are you sure? I thought that was changed in Base a while back.
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 always possible I'm wrong 😃. But this is the situation described in JuliaLang/julia#19137, and there's no indication the behavior has changed there.
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.
Ah, hmm. My bad 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.
AFAIK, without the ::F
, specialization will only happen if you call the function.
src/indexing.jl
Outdated
else | ||
return pda.pool[getindex(pda.refs, I...)] | ||
|
||
@generated function Base.getindex(pda::PooledDataArray, I::Integer...) |
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 would just @inline
this and the following.
test/operators.jl
Outdated
:(Base.lgamma), | ||
:(Base.digamma), | ||
:(Base.erf), | ||
:(Base.erfc)] |
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 longer in Base (same with erf
and digamma
)
Add SpecialFunctions as dependency Use new type keywords
Thanks for the comments. I've updated the code accordingly. The latest changes on master haven't made it into the Julia binary yet so we'll have to restart the tests when new binaries have been uploaded. |
src/indexing.jl
Outdated
@@ -114,6 +114,8 @@ Base.getindex(t::AbstractDataArray, i::Real) = | |||
|
|||
## getindex: DataArray | |||
|
|||
Base.linearindexing(x::Union{DataArray,PooledDataArray}) = Base.LinearFast() |
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.
This should be defined on the ::Type{<:Union{DataArray,PooledDataArray}}
, IIRC.
All of the remaining depwarns are from other packages. Does anything else need to happen here before this can be merged? LGTM. |
I think it is ready. |
Awesome. Unless there are further comments, I say we should merge this soon. |
@@ -1,14 +1,14 @@ | |||
__precompile__() | |||
|
|||
module DataArrays | |||
using Base: promote_op | |||
using Base.Cartesian, Compat, Reexport |
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.
Since Compat was removed from REQUIRE, it should be removed here too. (Not sure how this didn't cause CI to fail...)
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.
True. I think it is installed by the dependencies.
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.
Ah yeah, probably installed by StatsBase.
using Base.Cartesian, Compat, Reexport | ||
import Compat.String | ||
@reexport using StatsBase |
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.
This is tangential to the current changes, but it would make sense to me to stop reexporting StatsBase from this package. I'm not sure why we do it currently. If we do stop doing that, we could also drop the dependency on Reexport (not that it's a huge or problematic dependency, just saying).
test/broadcast.jl
Outdated
@@ -20,7 +20,7 @@ rb = 1:5 | |||
@test broadcast!(+, DataArray(Int, 2, 2), [1, 0], [1 4]) == [2 5; 1 4] | |||
@test broadcast!(+, DataArray(Int, 2), [1, 0], [1, 4]) == [2, 4] | |||
@test broadcast!(+, DataArray(Int, 2), [1, 0], 2) == [3, 2] | |||
@test broadcast!(abs, @data([-1, -2])) == @data([1, 2]) | |||
# @test broadcast!(abs, @data([-1, -2])) == @data([1, 2]) |
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.
Why is this commented out? Should it be removed altogether?
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. It should be removed. The in-place broadcast!
is deprecated in Base.
I've added Tests are failing because of a problem with the Julia binaries. I suggest that we just wait and see if tomorrow's binaries are more up to date. |
test/reducedim.jl
Outdated
@@ -109,7 +109,7 @@ macro test_da_approx_eq(da1, da2) | |||
v2 = $(esc(da2)) | |||
na = isna(v1) | |||
@test na == isna(v2) | |||
defined = !na | |||
defined = (!).(na) |
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.
.!na
should work here as you've written it elsewhere, right?
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.
Nope. Apparently, this form is required in macros. I tried the other version first.
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... bizarre. Maybe file a Base issue?
@@ -14,24 +14,28 @@ | |||
## | |||
############################################################################## | |||
|
|||
type NAtype | |||
struct NAtype |
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.
ERROR: LoadError: LoadError: syntax: extra token "NAtype" after end of expression
Stacktrace:
[1] include_from_node1(::String) at ./loading.jl:539
[2] include(::String) at ./sysimg.jl:14
[3] include_from_node1(::String) at ./loading.jl:539
[4] include(::String) at ./sysimg.jl:14
[5] anonymous at ./<missing>:2
while loading /home/travis/.julia/v0.6/DataArrays/src/natype.jl, in expression starting on line 17
??????
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.
For some reason, the nightly build used an older commit than the previous one and therefore it doesn't include the struct
changes. We can restart again when new binaries are up.
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.
Looks like this is still happening with the nightly binaries. 😕
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.
See https://status.julialang.org/. They are old. There is a problem on master that prevents the buildbot from making new ones.
src/broadcast.jl
Outdated
$(Expr(:block, [ | ||
:(@inbounds $(Symbol("v_$(k)")) = @nref $nd $(Symbol("A_$(k)")) d->$(Symbol("j_$(k)_d"))) | ||
for k = find(t -> !(t <: DataArray || t <: PooledDataArray), As)]...)) | ||
As[k] <: AbstractArray && !(As[k] <: Union{DataArray, PooledDataArray}) ? quote |
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 think you could do AbstractDataArray
instead of the Union
there.
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.
Good point
I'll suggest that I test this one locally against latest Julia master and merge if the tests pass since we don't know when we'll have new nightlies for Travis testing. |
Sounds like a good plan to me! |
Thanks so much for your hard work here, Andreas! |
The use of |
It makes the tests fail because for some reason the nightly binaries are stuck at a commit before the Base change due to issues with the buildbots. Hopefully that should be fixed soon. |
OK. But I guess it won't fix the tests on Julia 0.5, will it? |
Andreas bumped the minimum requirement for the package to 0.6-, so it won't work on 0.5 anyway. |
The main parts are the fixes for the broadcasting and indexing which both were broken on Julia master. There are many fixes of deprecated syntax and I've changed some uses of the old
ngenerate
in favor of generated functions. I've decided to remove support for Julia version prior to 0.6 to make the source as simple as possible. The package has been undermaintained for a while so I think we should focus on making maintenance as easy as possible. Prior version fo Julia can just use old versions of this package.@mbauman It would be appreciated if you could take a look at the indexing code. In particular, if it is really necessary with
@generated
in methods like https://github.com/JuliaStats/DataArrays.jl/blob/anj/06/src/indexing.jl#L164-L172 that used to be@ngenerate
d.@simonster You wrote most of the code touched here so any comments from you would also be appreciated.