However, doing the same reflection on functions requires you to have a
table of all function names at runtime. Which is quite uncommon to have inmany compilers.
Sure, but it's also a frequently asked question - I've seen developers
asking for the same thing in Java and C# for example, often resorting to
things like actually deploying metadata files for debugging; I've had to do
that myself in C# in the past.
Not pretty, but it was that or a bunch of redundant code - once you start
to rely on reflection, it gets frustrating when you realize it's incomplete
and can't take you all the way to the finish line.
I think Dart has the right answer - make it opt-in. You get the best of
both worlds then - a small footprint by default, and full-scale reflection
only when and where you deem necessary.
On Wed, Oct 8, 2014 at 2:01 PM, Jesper Louis Andersen wrote:
different thing than a method, and it probably has a different
representation at runtime. So in this case, it was relatively easy to
reflect on the methods (because there is a table of methods for values
which you can search through). However, doing the same reflection on
functions requires you to have a table of all function names at runtime.
Which is quite uncommon to have in many compilers.
--
J.
--On Wed, Oct 8, 2014 at 1:34 PM, Rasmus Schultz wrote:
It doesn't? Then how does this work:
http://golang.org/pkg/reflect/#Value.MethodByName
Technically, this is a way to get methods out of values. A "function" is aIt doesn't? Then how does this work:
http://golang.org/pkg/reflect/#Value.MethodByName
different thing than a method, and it probably has a different
representation at runtime. So in this case, it was relatively easy to
reflect on the methods (because there is a table of methods for values
which you can search through). However, doing the same reflection on
functions requires you to have a table of all function names at runtime.
Which is quite uncommon to have in many compilers.
--
J.
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.