>
http://codereview.appspot.com/4423043/diff/2002/src/pkg/gob/decode.go#newcode...
> src/pkg/gob/decode.go:1279: func allocValue(t reflect.Type)
> reflect.Value {
> i wonder if this should be in reflect.
I wonder too. I was very tempted to make reflect.New(t) return an
addressable, assignable t instead of a *t. In the end I decided to
be consistent with Go. If we change the name we could do it though.
AllocValue?
I also wondered whether NewValue should be named Valueof,
analogous to Typeof.
>
http://codereview.appspot.com/4423043/diff/2002/src/pkg/gob/decoder.go#newcod...
> src/pkg/gob/decoder.go:178: // value will be discarded. XXX
> XXX?
Updated:
// DecodeValue reads the next value from the connection.
// If v is the zero reflect.Value (v.Kind() == Invalid), DecodeValue
discards the value.
// Otherwise, it stores the value into v. In that case, v must represent
// a non-nil pointer to data or be an assignable reflect.Value (v.CanSet())
>
http://codereview.appspot.com/4423043/diff/2002/src/pkg/gob/decoder.go#newcod...
> src/pkg/gob/decoder.go:184: panic("gob: DecodeValue of unassignable
> value")
> should this panic? just return an error.
Done.
*** Submitted as http://code.google.com/p/go/source/detail?r=c1b858bc04cd *** changes for more restricted reflect.SetValue R=golang-dev, r CC=golang-dev http://codereview.appspot.com/4423043
Issue 4423043: code review 4423043: changes for more restricted reflect.SetValue
(Closed)
Created 14 years ago by rsc
Modified 14 years ago
Reviewers:
Base URL:
Comments: 3