FAQ
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.

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:

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 a
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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 8 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 8, '14 at 2:49a
activeOct 8, '14 at 12:22p
posts8
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase