Skip to content
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

Use pointer receiver for Key #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Freeaqingme
Copy link
Contributor

While debugging an issue I added the pointer receivers. I'm not sure if that's what made the difference, but it seems a good improvement nonetheless.

@prep
Copy link
Owner

prep commented Feb 17, 2019

Hey Dolf,

Apologies for the late reply.

Are you saying this solves a problem you were having, or are just preferring the aesthetics of having the methods on Key be pointer receivers? If it's the latter, I'm not against it per se, but none of those methods change the state of the Key so making them value receivers made more sense to me.

@Freeaqingme
Copy link
Contributor Author

Are you saying this solves a problem you were having

That I'm not sure about anymore :)

Advantages of using pointer receivers is that otherwise the struct would be copied for every method invocation. There was a nice blogpost that I'm thinking of but can't find it right now.

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