Yes but its the way it's done that i think could be made more straightforward, why not merge ValueOf and TypeOf in a build in intermediate reflect type as in for example int(4) but then reflect(4)
On Sunday, August 6, 2017 at 5:57:40 PM UTC+2, Rich wrote: > > I don't understand... doesn't Reflect already do this? > https://play.golang.org/p/CIm7aISztv > > > On Saturday, August 5, 2017 at 12:58:52 PM UTC-4, Gert wrote: >> >> package main >> >> import ( >> "fmt" >> "reflect" >> ) >> >> func main() { >> x := 4 >> v1 := reflect.ValueOf(x) >> fmt.Println("type:", v1.Type()) >> v2 := reflect.TypeOf(x) >> fmt.Println("type:", v2) >> } >> >> Kan we have something like this instead please >> >> package main >> >> import ( >> "fmt" >> "reflect" >> ) >> >> func main() { >> x := 4 >> r := reflect(x) >> fmt.Println("type:", r.Type()) >> fmt.Println("value:", r.Value(int)) >> } >> >> Reflect should be a generic way of Go2, but everytime i need to reflect >> around a Go1 interface i want to go on a vacation... >> >> -- 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.