-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Making StaticInt an Integer again? #73
Comments
The issue with making |
Is there any update on the suggestion to get StaticInt into Base? This seems like the obvious solution. There are concrete problems that arise from not doing this, are there any that would be caused by doing it? Is there somewhere we can help argue the case? Also... Are there also invalidations caused by making |
We can add that, right? |
That's a bit tricky because we'd have to add the optionally static range types and then we are moving into ArrayInterface territory. The separation is far from perfect but there are certain components here that just don't need to be in ArrayInterface |
Can we change it back to to a subtype of |
Here's the issue you can follow to voice opinions on its addition to base JuliaLang/julia#44538 (comment). |
Thanks for the detailed explanation @Tokazama - large numbers of invalidations are indeed definitely not great. @cscherrer , do you think we can use something like |
I'm open to PRs and suggestions, but I went through at least 3 rewrites of this package trying to find a solution that worked at all. At one point I started speaking in tongues (well, binary). So be careful going into any rewrites for your own sanity's well being |
Oh, sorry - I meant work around |
@cscherrer, if you're interested in separating out |
I've been trying to find a range type that works with the new static - Do the invalidations of "static being an integer" actually affect Static.jl itself or packages that use it? |
IIRC invalidations explode when we define conversion to |
Here's the big one we get when making a new subtype of inserting (::Type{T})(x::StaticInts.StaticInt) where T<:Integer in StaticInts at /Users/zchristensen/projects/Static.jl/libs/StaticInts/src/StaticInts.jl:27 invalidated:
mt_backedges: 1: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for convert(::Type{Int64}, ::Integer) (0 children)
2: signature Tuple{Type{UInt64}, Integer} triggered MethodInstance for convert(::Type{UInt64}, ::Integer) (0 children)
3: signature Tuple{Type{UInt32}, Integer} triggered MethodInstance for VersionNumber(::Integer, ::Int64, ::Int64, ::Tuple{}, ::Tuple{}) (1 children)
4: signature Tuple{Type{UInt64}, Integer} triggered MethodInstance for UInt64(::Enum) (1 children)
5: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for Int64(::Enum) (1 children)
6: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for insert!(::BitVector, ::Integer, ::Any) (2 children)
7: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for findprev(::InteractiveUtils.var"#34#39", ::AbstractString, ::Integer) (3 children)
8: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for Base._array_for(::Type{Union{Int64, Symbol}}, ::Base.HasLength, ::Integer) (6 children)
9: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for Base._array_for(::Type{Base.PkgId}, ::Base.HasLength, ::Integer) (6 children)
10: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for findnext(::Pkg.Types.var"#27#28"{String}, ::AbstractString, ::Integer) (38 children)
11: signature Tuple{Type{Int64}, Integer} triggered MethodInstance for Base.to_shape(::Integer) (470 children)
|
This is all you need to reproduce module StaticInts
struct StaticInt{N} <: Integer
StaticInt{N}() where {N} = new{N::Int}()
end
Base.Int(::StaticInt{N}) where {N} = N
end
|
@Tokazama , following up on the discussion on #87, I tried just changing using SnoopCompileCore
invalidations = @snoopr begin
using Static
end
using SnoopCompile
length(uinvalidated(invalidations)) and load time with
Given that, could we pursue making StaticInteger and Integer (which will re-enable statically sized Would
|
No. |
IRRC, a lot of the current invalidations are due to things with |
Ok so there no hard blockers? Then I'd try my hand at a |
I think the range invalidation s are mostly due to similar |
Since Static v0.7,
StaticInt
is not a subtype ofInteger
anymore. Would it be possible to change that again? Many constructions that usedStaticInt
in places that require anInteger
just aren't possible anymore now. For example,Base.OneTo(static(1))
doesn't work anymore and I'm sure there are lots of other uses cases that will find it hard (or impossible) to adapt their code to v0.7).CC @cscherrer
The text was updated successfully, but these errors were encountered: