- interface values is composed of (value, type)
- Reflection is a type of meta programming
- any interface values can be boxed into reflect.Value and reflect.Type
func (v Value) CanSet() bool
CanSet reports whether the value of v can be changed. A Value can be
changed only if it is addressable and was not obtained by the use of
unexported struct fields. If CanSet returns false, calling Value.Set or any
type-specific setter (e.g., Value.SetBool, Value.SetInt) will panic.
- addressable: need to be pointer variable
Although there are infinitely many types, there are only a finite number of kinds of type: the basic types Bool, String and all the numbers; the aggregate types Array and Struct, the reference types Chan, Func, Ptr, Slice and Map; interface types; and finally Invalid, meaning no value at all (The zero value of a reflect.Value has kind Invalid).
- the address operation
&xgenerates a pointer of type*Tto x. The operand must be addressable, that is, either a variable, pointer indirection, or slice indexing operation
&m["key"] // values in a map
&afunc() // return values from function
&t.method() // method callsv := afunc()
&v