Closed twpayne closed 7 years ago
I think this can be useful for many derives, not only deriveEqual
.
goderive simply needs to see a prefix to know that the function needs to be generated. You can add any descriptive suffix and it will still work.
And if you don't run it with -dedup you will get an error if you mistype it and call it with the same input types.
I hope that helps? Sorry for the delayed response.
On Tue, 29 Aug 2017, 19:52 Sergey Kostyaev, notifications@github.com wrote:
I think this can be useful for many derives, not only deriveEqual.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/awalterschulze/goderive/issues/33#issuecomment-325742955, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvsLTiCV1uYJxQbAadi6ZWdGZSWFglEks5sdE_kgaJpZM4PGSUo .
If you would like to add your project to the users list, please make a pull request :)
That is if I answered your question?
Thanks! That answers my question - I missed that you could derive multiple functions by using different suffixes. I'll submit a PR to make this more explicit in the README.md
and a PR for projects using goderive
when I get it working.
Awesome 😀 that will be much appreciated
On Fri, 1 Sep 2017, 10:05 Tom Payne, notifications@github.com wrote:
Thanks! That answers my question - I missed that you could derive multiple functions by using different suffixes. I'll submit a PR to make this more explicit in the README.md and a PR for projects using goderive when I get it working.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/awalterschulze/goderive/issues/33#issuecomment-326517554, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvsLYw60zPxRKtxbhiXGDdxZ1KFxDhrks5sd7rUgaJpZM4PGSUo .
I am interested in using
goderive
for https://github.com/twpayne/go-geom which exports multiple distinct types.Some packages may wish to derive functions for multiple types, for example:
In this case, there is an obvious conflict:
deriveEqual
cannot be overloaded to support both types.Running
goderive -autoname
resolves this conflict:The function names
derivedEqual
andderivedEqual_
are not particularly descriptive and easily misread or mis-typed. Instead they should include the name of the type, e.g.deriveEqual_MyFirstStruct
andderiveEqual_MySecondStruct
.