-
Notifications
You must be signed in to change notification settings - Fork 37
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
ArrayInterface.Size instead of ArrayInterface.size #241
Conversation
Codecov Report
@@ Coverage Diff @@
## master #241 +/- ##
==========================================
- Coverage 89.45% 88.59% -0.86%
==========================================
Files 11 11
Lines 1754 1780 +26
==========================================
+ Hits 1569 1577 +8
- Misses 185 203 +18
Continue to review full report at Codecov.
|
@ChrisRackauckas, this is related to the issue you raised here JuliaLang/julia#25107 |
No it isn't, because |
construct(::CPUPointer, ::Type{T}, param::Size) where {T} = Array{T}(undef, size(param))
function construct(d::AbstractDevice, ::Type{T}, param::Banded) where {T}
BandedMatrix(construct(d, T, Size(param)), bandwidths(param))
end
|
Why not go straight to making a |
We could have |
I'll have to look at this more closely, but would packages defining |
How are the downstream tests not failling? |
That's the intention. If this just breaks a bunch of stuff then I don't think it would be worth implementing something like this until we have a more complete story for the whole construction interface. |
The tests pass if the compat of the downstream package excludes this ArrayInterface version. |
|
The tricky bit is that we'd need both Size(x) = Size(size(x))
size(x) = Size(x).size One solution would be to use static_hasmethod to break the circle. |
Without an explicit method, |
Okay, that sounds fine. |
@Tokazama could you please fix downstream. The way that recent changes has broken downstream makes it so that things cannot update and it is blocking the actual purpose of this package. If it doesn't get fixed soon I think we should just see adding some of the static stuff as a mistake and revert it / remove it all. It's supposed to be an interface for missing verbs, not something that is breaking constantly. I'd say by the end of next week is about how long to wait until it's very clear that that direction was just wrong. |
This implements a formal type for extracting optionally static size info as I previously brought up here. If we do end up going this direction we can just leave a fall back to
ArrayInterface.size(x) = Size(x).size
so that we don't break any downstream code.I think this is more beneficial than just creating a greater distinction between
Base.size
andArrayInterface.size
. It also allows passingSize
as an unambiguous argument to methods likesimilar
allocate a new array but currently dispatch on various combinations of integers and unit ranges for thedims
argument. I'm hoping this could be used in combination withArrayInterface.AbstractDevice
to give us a more complete story for array constructors.