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

Issue 3608041: code review 3608041: reflect: add ArrayType.Slice, ArrayValue.Slice (Closed)

Can't Edit
Can't Publish+Mail
Start Review
9 years, 8 months ago by niemeyer
8 years, 10 months ago


reflect: add ArrayType.Slice, ArrayValue.Slice Right now it's not possible to use the data within a reflect.ArrayValue as an array without copying element by element individually out of the array, or knowing the array type and dimension in advance, which defeats the purpose of reflection. This changeset solves that problem by: a) Modifying the compiler to dump the slice type next to the array type itself, adding an extra element to {reflect,runtime}.ArrayType b) Introducing the Slice() method on ArrayType, giving access to its respective SliceType (analog to Elem()). c) Introducing Slice(beg, end) method on ArrayValue, giving access to a dynamic SliceValue (analog to SliceValue's Slice method). d) Adding the extra Slice(beg, end) SliceValue method into the ArrayOrSliceValue interface, since both of them are able to handle it correctly.

Patch Set 1 #

Patch Set 2 : code review 3608041: Right now it's not possible to use the data within a #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -1 line) Patch
M src/cmd/gc/reflect.c View 1 chunk +8 lines, -1 line 0 comments Download
M src/pkg/reflect/all_test.go View 1 chunk +23 lines, -0 lines 0 comments Download
M src/pkg/reflect/type.go View 2 chunks +4 lines, -0 lines 0 comments Download
M src/pkg/reflect/value.go View 2 chunks +15 lines, -0 lines 0 comments Download
M src/pkg/runtime/type.go View 1 chunk +1 line, -0 lines 0 comments Download


Total messages: 8
Hello r, rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
9 years, 8 months ago (2010-12-12 22:02:12 UTC) #1
Rob and Russ are more qualified to make a technical review of this change. I ...
9 years, 8 months ago (2010-12-12 22:41:11 UTC) #2
> I just wanted to point out that our change description style should > start ...
9 years, 8 months ago (2010-12-12 23:14:27 UTC) #3
The short summary as I understand it is reflect: add ArrayType.Slice, ArrayValue.Slice I'm not sure ...
9 years, 8 months ago (2010-12-13 02:42:22 UTC) #4
you managed to put in words what's been subconsciously bothering me. the analogy with T ...
9 years, 8 months ago (2010-12-13 05:17:20 UTC) #5
Hi Russ, > I'm not sure what I think of this. You claimed that > ...
9 years, 8 months ago (2010-12-13 12:35:13 UTC) #6
(updated the short summary)
9 years, 8 months ago (2010-12-13 12:36:34 UTC) #7
9 years, 6 months ago (2011-01-19 19:43:53 UTC) #8
Sign in to reply to this message.

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