I think you're right. The subtleties escape me as they changed several times around ~1.6 because of the requirements of the concurrent collector. I had thought that _anything_ that was not already pointer shaped was copied and the address of the copy was placed into the interface.
On Tuesday, 5 December 2017 18:41:51 UTC+11, Axel Wagner wrote: > > Slight correction (I think): If you store a non-pointer in an interface, > it won't store the address of the value (variable? values don't have an > address, strictly speaking), but will make a copy. Otherwise, this wouldn't > work: https://play.golang.org/p/P1YwxBk7lR > You can also see these effects here (and feel free to play around a bit): > https://play.golang.org/p/GqAUn31A1y > > On Tue, Dec 5, 2017 at 2:44 AM, Dave Cheney <da...@cheney.net > <javascript:>> wrote: > >> >> >> On Tuesday, 5 December 2017 12:19:29 UTC+11, simon place wrote: >>> >>> in a very similar vein, something i have been wondering about for a >>> while now; >>> >>> when an interface contains a pointer type, does Go double dereference or >>> conflate the pointers? >>> >> >> If the *type* of the value placed into the interface is pointer shaped >> then it value is used as is, if not, the address of the value is taken, and >> the address is used as the interface's value. >> >> >> -- >> 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...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.