*** Submitted as https://code.google.com/p/go/source/detail?r=1f43d831c825 *** reflect: document the unreliability of StringHeader and SliceHeader R=golang-dev, adg, ...
12 years, 1 month ago
(2013-04-08 01:42:36 UTC)
#5
https://codereview.appspot.com/8494045/diff/4002/src/pkg/reflect/value.go File src/pkg/reflect/value.go (right): https://codereview.appspot.com/8494045/diff/4002/src/pkg/reflect/value.go#newcode1706 src/pkg/reflect/value.go:1706: // a separate, correctly typed pointer to the underlying ...
12 years, 1 month ago
(2013-04-08 02:56:58 UTC)
#6
Message was sent while issue was closed.
https://codereview.appspot.com/8494045/diff/4002/src/pkg/reflect/value.go
File src/pkg/reflect/value.go (right):
https://codereview.appspot.com/8494045/diff/4002/src/pkg/reflect/value.go#new...
src/pkg/reflect/value.go:1706: // a separate, correctly typed pointer to the
underlying data.
s/correctly typed/correctly-typed/ ?
"so programs must keep a separate string or correctly-typed pointer to..."
Also, I know we don't use the word "reference", but "pointer" feels weird here,
considering we're talking about a string, where the pointer isn't typically
visible. On one hand, I'm sure anybody using reflect+unsafe knows what they're
doing (eventually), but it also invites questions about why this is uintptr
instead of *byte or, and whether *string is needed to keep it alive.
Calling out "string" somehow like above might clarify both. Or noting that that
uintptr is for historical compatibility reasons.
Maybe this is bike shedding, though.
https://codereview.appspot.com/8494045/diff/4002/src/pkg/reflect/value.go
File src/pkg/reflect/value.go (right):
https://codereview.appspot.com/8494045/diff/4002/src/pkg/reflect/value.go#new...
src/pkg/reflect/value.go:1706: // a separate, correctly typed pointer to the
underlying data.
On 2013/04/08 02:56:58, bradfitz wrote:
> s/correctly typed/correctly-typed/ ?
it's correct as is. we're not making an adjective.
> "so programs must keep a separate string or correctly-typed pointer to..."
it's a pointer to the data. if you (not you, but some other you) need that
explained to you, and you don't understand that a string includes a pointer, you
shouldn't be within a hundred yards of this type.
Issue 8494045: code review 8494045: reflect: document the unreliability of StringHeader and...
(Closed)
Created 12 years, 1 month ago by r
Modified 12 years ago
Reviewers: bradfitz
Base URL:
Comments: 2