-
Notifications
You must be signed in to change notification settings - Fork 54
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
make LessThan, Equal and Compare accept a pointer type #20
Comments
Why do you think this'd help usability? It's pretty trivial to dereference
inline during the call (e.g. `foo.Compare(*bar)`)
As to why value vs pointer - I think it clearly distinguishes that the
methods are non-mutating and the type is trivial enough that I don't think
the copy overhead should be concerning. Generally seems like we're
conforming with the idiomatic go guidance:
https://golang.org/doc/faq#methods_on_values_or_pointers
…On 20 December 2016 at 15:36, alexanderwilling ***@***.***> wrote:
For usability, it would be nice if one could pass a *semver.Version to
LessThan(), Equal(), and Compare(). Is there something preventing this?
And why are those methods defined on a value receiver instead of a pointer
receiver?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#20>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACewN6Gylzh6AyRJNpfaC65m_wOztiHvks5rJ-f3gaJpZM4LR5r2>
.
|
Because right now, I can't write for example Regarding the receiver type, the link you provided also says:
The |
Fair point, although arguably the current situation is a bit more flexible (because you can dereference inline but not reference inline).
hoisted by my own petard ;-). IMO the current situation is still cleaner but if you feel really really strongly about it you could put up a PR
Strange, I can't seem to reproduce |
For usability, it would be nice if one could pass a
*semver.Version
toLessThan()
,Equal()
, andCompare()
. Is there something preventing this? And why are those methods defined on a value receiver instead of a pointer receiver?The text was updated successfully, but these errors were encountered: