For me this is the most inconsistent and obtuse aspect of the Go language. It 
seems it would always be saner to treat interfaces as pointers. Which would 
mean if they had non pointer receiver methods might force more objects to be 
allocated on the heap - but it would prevent a lot of misunderstanding and 
subtle bugs. 

> On Jun 6, 2021, at 5:43 AM, 'Dan Kortschak' via golang-nuts 
> <[email protected]> wrote:
> 
> On Sun, 2021-06-06 at 03:17 -0700, Brian Candler wrote:
>> When you assign a regular (non-pointer) value to an interface
>> variable, it does take a copy of that value:
>> https://play.golang.org/p/XyBREDL4BGw
> 
> It depends on whether it's safe to leave uncopied or not. You can see
> this here https://play.golang.org/p/q1729cX09BQ
> 
> 
> -- 
> 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 [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/e77e2a94d0c16514e74340a891f02e118e185d59.camel%40kortschak.io.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BBC4CAE4-9A6E-46EB-9E1D-681C40C5E8EF%40ix.netcom.com.

Reply via email to