Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(255)

Issue 4239052: code review 4239052: reflect: add PtrTo, add Value.Addr (old Addr is now Uns... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by rsc
Modified:
14 years ago
Reviewers:
CC:
r, rog, golang-dev
Visibility:
Public.

Description

reflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr) This change makes it possible to take the address of a struct field or slice element in order to call a method that requires a pointer receiver. Existing code that uses the Value.Addr method will have to change (as gob does in this CL) to call UnsafeAddr instead.

Patch Set 1 #

Patch Set 2 : diff -r 262b13e908a6 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 262b13e908a6 https://go.googlecode.com/hg/ #

Total comments: 8

Patch Set 4 : diff -r 262b13e908a6 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 5 : diff -r c2eab411f0ee https://go.googlecode.com/hg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+285 lines, -52 lines) Patch
M src/pkg/gob/decode.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/gob/encode.go View 1 2 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/reflect/all_test.go View 1 2 2 chunks +75 lines, -0 lines 0 comments Download
M src/pkg/reflect/deepequal.go View 1 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/reflect/type.go View 1 2 3 5 chunks +87 lines, -1 line 0 comments Download
M src/pkg/reflect/value.go View 1 2 3 31 chunks +115 lines, -43 lines 0 comments Download

Messages

Total messages: 12
rsc
Hello r (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years ago (2011-03-03 05:17:33 UTC) #1
r
http://codereview.appspot.com/4239052/diff/4001/src/pkg/reflect/type.go File src/pkg/reflect/type.go (right): http://codereview.appspot.com/4239052/diff/4001/src/pkg/reflect/type.go#newcode713 src/pkg/reflect/type.go:713: // PtrTo returns the pointer type with element t. ...
14 years ago (2011-03-03 05:37:46 UTC) #2
r
http://codereview.appspot.com/4239052/diff/4001/src/pkg/reflect/type.go File src/pkg/reflect/type.go (right): http://codereview.appspot.com/4239052/diff/4001/src/pkg/reflect/type.go#newcode758 src/pkg/reflect/type.go:758: p.hash = ct.hash*16777619 ^ '*' // one step of ...
14 years ago (2011-03-03 05:38:16 UTC) #3
rog
LGTM nice to see - this change means that, for example, the type of RPC ...
14 years ago (2011-03-03 07:31:19 UTC) #4
rsc
PTAL > http://codereview.appspot.com/4239052/diff/4001/src/pkg/reflect/type.go#newcode713 > src/pkg/reflect/type.go:713: // PtrTo returns the pointer type with > element t. ...
14 years ago (2011-03-03 14:22:21 UTC) #5
rsc
[sorry, gmail imagined that i clicked send a little early on that last one.] PTAL ...
14 years ago (2011-03-03 14:26:22 UTC) #6
r
oh, this means lots of things are possible. -rob
14 years ago (2011-03-03 16:48:42 UTC) #7
r
LGTM http://codereview.appspot.com/4239052/diff/9/src/pkg/reflect/all_test.go File src/pkg/reflect/all_test.go (right): http://codereview.appspot.com/4239052/diff/9/src/pkg/reflect/all_test.go#newcode1414 src/pkg/reflect/all_test.go:1414: typ = typ.(*PtrType).Elem() it's only a test and ...
14 years ago (2011-03-03 17:36:45 UTC) #8
rog
On 3 March 2011 16:48, Rob 'Commander' Pike <r@golang.org> wrote: > oh, this means lots ...
14 years ago (2011-03-03 18:02:20 UTC) #9
rsc
> for instance... does gob need to be unsafe any more? yes. gob is unsafe ...
14 years ago (2011-03-03 18:17:39 UTC) #10
rsc
*** Submitted as 5e9b7195ed0d *** reflect: add PtrTo, add Value.Addr (old Addr is now UnsafeAddr) ...
14 years ago (2011-03-03 18:20:18 UTC) #11
rog
14 years ago (2011-03-03 18:27:57 UTC) #12
On 3 March 2011 18:17, Russ Cox <rsc@golang.org> wrote:
> in a week or so, i am going to send out a proposal for a new reflect API
> that would eliminate almost all the allocations and probably
> be nicer to use.

that's quite exciting. things will speed up.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b