On 7 August 2017 at 16:22, Gert Cuykens <gert.cuyk...@gmail.com> wrote: > On Mon, Aug 7, 2017 at 12:03 PM, roger peppe <rogpe...@gmail.com> wrote: >> ISTM that the only thing you're suggesting is to change >> the spelling of "reflect.ValueOf" to "reflect". >> >> I don't understand what semantics you'd expect >> >> fmt.Println("value:", r.Value(int)) >> >> to have. What's the parameter to that Value method? >> > > Merge ValueOf and TypeOf into one reflect() build in
reflect.TypeOf is strictly a convenience anyway - you can always write reflect.ValueOf(x).Type() instead. So this suggestion is just equivalent to doing: func reflect(x interface{}) reflect.Value { return reflect.ValueOf(x) } (except you can't do that, because reflect is the name of the package, which is an issue with your suggestion too). > (and make the > reflect type transform easier with other types fmt.Println("value:", > int(r.Value)) What is this supposed to do? What does it do if the value isn't an integer? Are you thinking that it would be the same as fmt.Println("value:", r.Interface().(int)) ? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.