On 21 April 2017 at 15:26, st ov <so.qu...@gmail.com> wrote:
>
> When deciding between method receivers, any advice on how to choose which
> to use?
> Is it as simple as, when you need to change the instance pass a pointer,
> otherwise pass a value. And then once one method requires a pointer, then
> all methods should use a pointer.
>

Yes, that's about it.



> When given a type whose instance could be large, but its methods do not
> require a pointer, is it idiomatic to still pass a value in the constructor
> and all method receivers?
>

It's quite common to pass pointers to avoid the (imagined) overhead of
copying large values, even when not strictly necessary.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to