rafaqz / Interfaces.jl

Macros to define and implement interfaces, to ensure they are checked and correct.
MIT License
72 stars 4 forks source link

add some more interfaces to BaseInterfaces.jl #27

Closed rafaqz closed 8 months ago

rafaqz commented 8 months ago

This PR adds the start of AbstractSet, AbstractDict, and AbstractArray to BaseInterfaces.jl

Hopefully this will end with interface tests that help people write interfaces for these base types and know they are correct and complete.

@gdalle thoughts or contributions to the cause would be appreciated!

codecov-commenter commented 8 months ago

Codecov Report

Merging #27 (fee8bb5) into main (b23bfa5) will decrease coverage by 3.82%. The diff coverage is 75.00%.

@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
- Coverage   86.20%   82.38%   -3.82%     
==========================================
  Files           5        5              
  Lines         145      159      +14     
==========================================
+ Hits          125      131       +6     
- Misses         20       28       +8     
Files Coverage Δ
src/implements.jl 72.72% <50.00%> (-2.28%) :arrow_down:
src/test.jl 82.60% <75.86%> (-4.77%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

gdalle commented 8 months ago

Wow, large effort! I'll try to review it in the coming days. Just wondering, did you check out other initiatives like https://github.com/JuliaArrays/ArrayInterface.jl?

rafaqz commented 8 months ago

Yeah, I've been following ArrayInterface for some years.

But ArrayInterface.jl really isn't the same as the base AbstractArray interface. As the docs say:

The purpose of this library is to solidify extensions to the current AbstractArray interface

(emphasis mine)

The idea in BaseInterfaces.jl is just to have a simple definitions of Base Julia interfaces as far as they are documented, or as used in Base where they are not documented. Its a test of Interfaces.jl capacity to represent a range of interfaces, and should be useful for people extending theses interfaces to have a predefined test suit for them. I'm not sure that the @implements declarations will actually be used or useful, but that's ok.

Of course, there will be some overlap in terms of traits as ArrayInterface.jl does include some traits for simple base interface things as well.

gdalle commented 8 months ago

Feel free to ping me when this is more or less ready for review!

rafaqz commented 8 months ago

Any time really, feedback would be good. It will be a work in progress untul we register, so we can merge PRs as we go.

gdalle commented 8 months ago

Okay cool, I'll try to take a look

rafaqz commented 8 months ago

Thanks for the feedback, I've implemented most of these and a bunch more. Also fixed up testing and display a lot and accidentally merged it here! But will merge as-is anyway and more can be added in another PR.