go/src
Russ Cox fb175cf77e reflect: new Type and Value definitions
Type is now an interface that implements all the possible type methods.
Instead of a type switch on a reflect.Type t, switch on t.Kind().
If a method is invoked on the wrong kind of type (for example,
calling t.Field(0) when t.Kind() != Struct), the call panics.

There is one method renaming: t.(*ChanType).Dir() is now t.ChanDir().

Value is now a struct value that implements all the possible value methods.
Instead of a type switch on a reflect.Value v, switch on v.Kind().
If a method is invoked on the wrong kind of value (for example,
calling t.Recv() when t.Kind() != Chan), the call panics.

Since Value is now a struct, not an interface, its zero value
cannot be compared to nil.  Instead of v != nil, use v.IsValid().
Instead of other uses of nil as a Value, use Value{}, the zero value.

Many methods have been renamed, most due to signature conflicts:

           OLD                          NEW

    v.(*ArrayValue).Elem             v.Index
    v.(*BoolValue).Get               v.Bool
    v.(*BoolValue).Set               v.SetBool
    v.(*ChanType).Dir                v.ChanDir
    v.(*ChanValue).Get               v.Pointer
    v.(*ComplexValue).Get            v.Complex
    v.(*ComplexValue).Overflow       v.OverflowComplex
    v.(*ComplexValue).Set            v.SetComplex
    v.(*FloatValue).Get              v.Float
    v.(*FloatValue).Overflow         v.OverflowFloat
    v.(*FloatValue).Set              v.SetFloat
    v.(*FuncValue).Get               v.Pointer
    v.(*InterfaceValue).Get          v.InterfaceData
    v.(*IntValue).Get                v.Int
    v.(*IntValue).Overflow           v.OverflowInt
    v.(*IntValue).Set                v.SetInt
    v.(*MapValue).Elem               v.MapIndex
    v.(*MapValue).Get                v.Pointer
    v.(*MapValue).Keys               v.MapKeys
    v.(*MapValue).SetElem            v.SetMapIndex
    v.(*PtrValue).Get                v.Pointer
    v.(*SliceValue).Elem             v.Index
    v.(*SliceValue).Get              v.Pointer
    v.(*StringValue).Get             v.String
    v.(*StringValue).Set             v.SetString
    v.(*UintValue).Get               v.Uint
    v.(*UintValue).Overflow          v.OverflowUint
    v.(*UintValue).Set               v.SetUint
    v.(*UnsafePointerValue).Get      v.Pointer
    v.(*UnsafePointerValue).Set      v.SetPointer

Part of the motivation for this change is to enable a more
efficient implementation of Value, one that does not allocate
memory during most operations.  To reduce the size of the CL,
this CL's implementation is a wrapper around the old API.
Later CLs will make the implementation more efficient without
changing the API.

Other CLs to be submitted at the same time as this one
add support for this change to gofix (4343047) and update
the Go source tree (4353043).

R=gri, iant, niemeyer, r, rog, gustavo, r2
CC=golang-dev
https://golang.org/cl/4281055
2011-04-08 12:26:51 -04:00
..
cmd gofix: be more conservative about rewrite to os.Create 2011-04-08 10:59:25 -04:00
lib9 lib9, libmach: Change GOOS references to GOHOSTOS 2011-03-15 14:42:18 -04:00
libbio
libmach lib9, libmach: Change GOOS references to GOHOSTOS 2011-03-15 14:42:18 -04:00
pkg reflect: new Type and Value definitions 2011-04-08 12:26:51 -04:00
Make.ccmd
Make.clib
Make.cmd build: remove duplicate dependency in Make.cmd 2011-03-14 12:33:44 -04:00
Make.common build: avoid calling gomake wrapper in recursive make 2011-03-05 14:53:29 -05:00
Make.inc goinstall: handle $(GOOS) and $(GOARCH) in filenames 2011-03-07 10:54:53 -05:00
Make.pkg src/pkg/Makefile: trim per-directory make output except on failure 2011-04-06 15:06:28 -04:00
all-qemu.bash build: add all-qemu.bash, handful of arm fixes 2011-03-27 23:39:42 -04:00
all.bash
clean.bash build: reenable clean.bash without gomake 2011-03-21 00:27:50 -03:00
env.bash build: move $GOBIN ahead of /bin, /usr/bin in build $PATH 2011-02-28 14:55:27 -05:00
make.bash build: diagnose Ubuntu's buggy copy of gold 2011-03-18 18:23:00 -04:00
quietgcc.bash
run.bash test/bench: enable build and test on Windows 2011-04-08 10:43:25 +10:00
sudo.bash
version.bash version.bash: strip changeset hash from 'hg tags' output 2011-04-04 10:06:09 +10:00