-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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 hash
and ==
for LibGit2.Oid
#14319
Conversation
43c8407
to
f95b85d
Compare
|
||
cmp(id1::Oid, id2::Oid) = int(ccall((:git_oid_cmp, :libgit2), Cint, | ||
(Ptr{Oid}, Ptr{Oid}), Ref(id1), Ref(id2))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it seems that this is not tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess so. Perhaps hashing and comparing these Oids is not even necessary; I'm hoping somebody who knows this code better can comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently use the bytestring SHA's everywhere, but that should be transitioned over to using Oid's for some type safety.
replace duplicate Oid `isequal` definitions with `==`
f95b85d
to
7f8fd0e
Compare
Food for thought on protocols. With implicit protocol satisfaction, this would silently fail to implement the |
Point taken. However some careful design is needed. For example, I might implement |
I actually think just having
written down somewhere helps a lot with this. The docs for |
Yeah, I'm still pretty up in the air about which is better myself. I'm slightly inclined towards explicit opt-in. |
I'm fine with an explicit version if we can come up with a nice design. To me, the key is that being able to ask whether type X implements a protocol is strictly separate from wanting X to implement the protocol. So to me it would be a shame if the core design tied these together. |
True, those are definitely distinct. Do you think it's a good idea to allow the programmer to express that they want to implement a protocol without implementing it? If so, which one does dispatch pay attention to? |
The best thing I can think of currently is (1) build in the fully-implicit version, (2) be able to write something like |
fix `hash` and `==` for LibGit2.Oid
I happened to find these minor infelicities in the libgit2 code.