Skip to content
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

Clean @pure issues in "dimensions.jl" and "static.jl" #119

Merged
merged 3 commits into from
Feb 8, 2021

Conversation

Tokazama
Copy link
Member

@Tokazama Tokazama commented Feb 7, 2021

This doesn't completely fix #115, but it does take care of the problems with Symbol. I'll update that issue with what still needs to be worked on.

Although this commit changes how dimnames works and completely gets rid of a couple methods it shouldn't be breaking because none of these are actually part of the README and no packages should depend on them at this point.

I also moved static to the README because I think it's worth making part of the public API. I think it' more convenient than typing out the entirety of a static types name.

@codecov
Copy link

codecov bot commented Feb 7, 2021

Codecov Report

Merging #119 (ebd33e8) into master (db2cfb4) will increase coverage by 1.08%.
The diff coverage is 87.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
+ Coverage   84.76%   85.85%   +1.08%     
==========================================
  Files           8        8              
  Lines        1510     1527      +17     
==========================================
+ Hits         1280     1311      +31     
+ Misses        230      216      -14     
Impacted Files Coverage Δ
src/ranges.jl 91.48% <ø> (ø)
src/dimensions.jl 92.07% <85.45%> (+2.47%) ⬆️
src/static.jl 85.83% <85.71%> (+4.01%) ⬆️
src/ArrayInterface.jl 84.85% <100.00%> (+0.03%) ⬆️
src/indexing.jl 89.02% <100.00%> (ø)
src/stridelayout.jl 81.77% <100.00%> (+1.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db2cfb4...cf75f35. Read the comment docs.

Cleaned up code in src/dimensions.jl and test/dimensions.jl
Copy link
Collaborator

@chriselrod chriselrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. My primary suggestion is to add Base.@aggressive_constprop, either using @static if VERSION >= v"1.7.0-DEV.421" (or whatever the specific version that added it is, if you want to spend the time to find out) to switch between two definitions, or maybe make one definition of each function annotated with @aggressive_constprop and have:

@static if VERSION >= v"1.7.0-DEV.421"
    using Base: @aggressive_constprop
else
    macro aggressive_constprop(ex)
        ex
    end
end

@@ -208,6 +208,10 @@ For example, if `A isa Base.Matrix`, `offsets(A) === (StaticInt(1), StaticInt(1)

Is the function `f` whitelisted for `LoopVectorization.@avx`?

## static(x)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we at the point yet where we should just create a Static.jl and depend on it?

We have static Ints, Bools, and now Symbols.
Octavian also has staticfloats.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking the same thing. There is already StaticNumbers.jl but I think there is a lot of utility in a very restricted set of static types. I think there has been a tendency with projects that deal with "staticness" to just solve everything with a new static type, which creates another problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do think a package like Static.jl should go?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just created SciML/Static.jl and added you as a contributor.

I'm not sure about ArrayInterface's functionality vs StaticNumbers.jl, but ArrayInterface's has definitely been growing.
I should've added static ranges to the list of things we support here.

But I do agree on the idea of having a narrower scope / focusing on being a lightweight dependency that other packages that want such functionality (including of course ArrayInterface.jl) can cheaply depend upon.

README.md Outdated Show resolved Hide resolved
src/static.jl Outdated Show resolved Hide resolved
src/static.jl Outdated Show resolved Hide resolved
src/static.jl Outdated Show resolved Hide resolved
@chriselrod
Copy link
Collaborator

Looks good. Merge when ready.

@Tokazama Tokazama merged commit 9d0843f into master Feb 8, 2021
@Tokazama Tokazama deleted the static-symbol branch February 9, 2021 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using Base.@pure in ArrayInterface causes 265 problems
2 participants