-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: Julia 1.9 does not have _maybetail in Base #25
Conversation
Codecov Report
@@ Coverage Diff @@
## master #25 +/- ##
=======================================
Coverage 66.66% 66.66%
=======================================
Files 1 1
Lines 42 45 +3
=======================================
+ Hits 28 30 +2
- Misses 14 15 +1
Continue to review full report at Codecov.
|
Given that 1.6 has both |
As was mentioned in a previous discussion by @timholy , this package has usefulness beyond the functionality available in Base. Basically, it allows to pass relative ranges as arguments to functions which isn't currently possible with Base. I have been using this for the same to achieve similar functionality to python function foo(vectorA, mrange::Union{AbstractRange,EndpointRange})
# Do something with vectorA[mrange]
end It would not always make sense to pass I agree that the need of the package is less in julia compared to python due to presence of Also see this related discussion in discourse. |
Some of this functionality might be easier to copy over into ArrayInterface.jl with just a couple lines of code. The |
@static if VERSION >= v"1.9.0-DEV.827"
Base._to_indices1(A, inds, I1::Union{Endpoint, EndpointRange}) = (_newindex(inds, I1),)
else
@inline function Base.to_indices(A, inds, I::Tuple{Union{Endpoint, EndpointRange}, Vararg{Any}})
(_newindex(inds, I[1]), to_indices(A, Base.safe_tail(inds), Base.tail(I))...)
end
end
_newindex(::Tuple{}, I1) = newindex(Base.OneTo(1), I1) # This also fix `randn(2)[1:iend,1:iend]`
_newindex(inds::Tuple, I1) = newindex(inds[1], I1) |
Inference is just one of the issues |
In fact, the allocation and slowness should all come from the runtime dispatch (At least for the examples in A more serious problem may be |
How is it telling someone to overload some internal api? The current design in base is flawed the in multiple and that's not changing anytime soon. We have a good set of tools for addressing this in ArrayInterface so it might be helpful to consider using it |
Well, just as I mentioned above. User should overload
|
Sorry, I thought you were saying that I had suggested overloading internal methods.
I've been casually trying to figure out how to move towards easily injecting some of this improvements into |
No description provided.