>From the Laws of Reflection[1]: > It's a powerful tool that should be used with care and avoided unless > strictly necessary.
The reflect package is not mentioned in the spec (except once to discuss struct tags), adding a built-in would require its definition there, and complicate the language. Making it easier to use would also have the disadvantage of increasing its use, packages with heavy reflect use tend to be harder to reason about by virtue of having reduced type constraints. [1]https://blog.golang.org/laws-of-reflection On Sun, 2017-08-06 at 13:51 -0700, Gert wrote: > 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) -- 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.