-
Notifications
You must be signed in to change notification settings - Fork 4
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
Moved test objects to test method #10
Conversation
4b3a189
to
3e196e6
Compare
Codecov Report
@@ Coverage Diff @@
## main #10 +/- ##
==========================================
- Coverage 81.48% 77.35% -4.13%
==========================================
Files 3 4 +1
Lines 108 106 -2
==========================================
- Hits 88 82 -6
- Misses 20 24 +4
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks. It definitely feels slicker to move those definitions into the I'm just wondering if we lose anything? I think my original idea was that a user could run If you cant think of any other downside to this, lets merge it. |
3e196e6
to
8dc5408
Compare
I think it is better to require that test objects are provided/created with the tests. It could be encouraged that packages somehow make test values/objects available for themselves and for downstream packages if that was/is your concern? I.e. was your concern with the ease of interface testing wrt. sub-types of a hierarchy where an interface is defined for a supertype? |
I think you were right saying (in #9) that the interface definitions should work on types - not values/objects. There's still a few mentions of objects - that could probably be cleaned up in a follow-up. |
Also, |
Thanks for checking JET. Can you post the output? Probably my concern over test objects isn't that important for now, and we should follow YAGNI. |
Probably not related to this branch: ═════ 4 possible errors found ═════ |
Oh right JET wants us to define a method for the |
Yet another consideration following this change: I think I would prefer if the arguments for |
Haha I guess that's a matter of taste, maybe I think about it the other way around. If you think its better, I'll merge the PR, clearly Jacob thinks its better too. |
Also I find it hilarious how similar @quinnj s implementation is - I didn't read it before writing this. Some differences in design, but all the same function, types and macros, how is that possible |
He he - that's funny indeed :-) But isn't (at least) the interface definition a bit different in only declaring method signatures? Where the predicate approach can check much more complex interactions? @interface Iterable begin
iterate(::Iterable)
iterate(::Iterable, st)
Base.IteratorSize(::Type{Iterable})::Union{Base.HasLength, Base.HasShape, Base.IsInfinite, Base.SizeUnknown}
if Base.IteratorSize(Iterable) == Base.HasLength()
length(::Iterable)
elseif Base.IteratorSize(Iterable) isa Base.HasShape
length(::Iterable)
size(::Iterable)
end
Base.IteratorEltype(::Type{Iterable})::Union{Base.HasEltype, Base.EltypeUnknown}
if Base.IteratorEltype(Iterable) == Base.HasEltype()
eltype(::Iterable) || eltype(::Type{Iterable})
end
end |
I really havent read it as closely as you, I meant on a really surface level scan of the code. That syntax does look nice though... but do you mean it cant actually check return values? I thought the main difference overall was that my version gives other packages a breakdown of the implementation of each interface as traits. (My idea was really a hacked together Haskell typeclasses thing where it was knowable at compile time what objects had what behaviours. The other parts of the design are a bit more random.) |
@stemann (now I remember, lol) having Duck() in the I really liked the idea of having it all automated so the interface was more reliable. But people didn't like the potential overheads of that approach, so it was dropped and now you have to run |
Ah, yes - so this PR actually supports the change you made in #8. While digging around, I also noticed your reasoning in lorenzoh/Invariants.jl#2 (comment) |
Yeah, I think that that syntax also merits some consideration. It's been a while since I looked at https://github.com/quinnj/Interfaces.jl - but I would think that it can check what is specified in the interface - that methods exist and with the proper signatures - including return value types, but not return values, no. Probably worth getting back to in #9 (or a follow-up - to get #9 closed). In my view, your version provides a much more flexible interface specification - covering all of:
... though I'm still not completely clear if interfaces with optional parts is better than separating optional parts into separate interface specifications (cf. #9). |
I think the last point will need to be resolved by implementing a bunch of interfaces for base and package types. There are often kind of irrelevent parts of an interface that are nevertheless still part of it. For example a DimensionalData.jl It felt really clunky to me define an interface spec for these tiny things separately. My hunch is that people wont do it unless it also feels trivial. |
Note there is also https://github.com/Keno/InterfaceSpecs.jl with similar ideas |
Also with what looks like proof solver built in 😂 Nice to have that "ok there are smarter people working on this now" feeling |
Indeed! 😃 I think I’ve finally grasped what Keno is saying - after the third read or so :-) But it might be worthy of a separate issue to consider the suggestion of being open to extension with proof engines. … and the forall 👀 IIUC Keno shared his thoughts to “aid the direction” of, e.g. these efforts. |
As discussed in #9