On Tue, Nov 10, 2020 at 11:09 AM shan...@gmail.com <shane....@gmail.com> wrote:
> My confusion is this, the comment says (very clearly) > It's not safe, nor portable, and may change (although I have had it pointed > out to me that the comparability guarantee may contradict this) It does not. When there exists explicit documentation for the contrary, it means the contrary. > Further the Data field reference won't stop the Garbage collector removing > the data It's the same as for any other uintptr anywhere else. It's not a pointer and thus does not guarantee reachability of its "pointee". The documentation just reminds of this. > So, can someone explain to me what it's purpose in life is (there's > suggestion that it was a temporary fix that, like all things temporary, has > become permanent, and if so, I wonder if that means the documentation needs > updating) This does not make reflect.SliceHeader unusable though. The reflect.SliceHeader is either aliased to a real slice or is later unsafely converted to one. Then the uintptr field is no more an uintptr, but a real pointer. The documentation points out that _in between_ one has to guarantee the reachability by other means, the only pseudo-reference of the uintptr value is not sufficient for that. I see nothing in the documentation that needs to be updated. It's possible that it could be improved to become better understood as it seems it's not always working that way. -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-V1aqBry_aUMwnVkm6LtUcGXXmTtPjLDr1z2pdGZui9Wg%40mail.gmail.com.