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

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

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 4 months ago by niemeyer
Modified:
12 years, 7 months ago
Reviewers:
CC:
golang-dev
Visibility:
Public.

Description

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

Messages

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