Descriptionreflect: 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 #
MessagesTotal messages: 8
|