Skip to content

Implicit Operator: GitOid => ObjectId#357

Closed
dahlbyk wants to merge 2 commits into
libgit2:vNextfrom
dahlbyk:implicit
Closed

Implicit Operator: GitOid => ObjectId#357
dahlbyk wants to merge 2 commits into
libgit2:vNextfrom
dahlbyk:implicit

Conversation

@dahlbyk

@dahlbyk dahlbyk commented Feb 28, 2013

Copy link
Copy Markdown
Member

The only thing we ever do with a GitOid is turn it into an ObjectId, so I figure we might as well make the conversion trivial (and null-friendly, as I have found I need with submodules).

@nulltoken

Copy link
Copy Markdown
Member

Although I'm usually not a big fan of implicit cast (hard to discover and tend to make the code somewhat surprising to read/review), this one can't bite the consumer of the library and cuts off some code noise.

Beside this, the two types bear the exact same meaning 👍

Merged! ❤️

@nulltoken nulltoken closed this Feb 28, 2013
@dahlbyk

dahlbyk commented Feb 28, 2013

Copy link
Copy Markdown
Member Author

Although I'm usually not a big fan of implicit cast (hard to discover and tend to make the code somewhat surprising to read/review), this one can't bite the consumer of the library and cuts off some code noise.

That was my thought process behind implicit string => FilePath as well.

How do you feel about explicit casts? Specifically, it might be useful to have one for string => ObjectId to simplify test scenarios where InlineData specifies an expected (possibly null) ObjectId as a string.

@nulltoken

Copy link
Copy Markdown
Member

How do you feel about explicit casts? Specifically, it might be useful to have one for string => ObjectId to simplify test scenarios where InlineData specifies an expected (possibly null) ObjectId as a string.

👍

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.

2 participants