Jump to content
  • Advertisement
Sign in to follow this  
Lode

what's the official name of this concept?

This topic is 3791 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What's the official name of the following concept or pattern? The ability to access parameters of a class using a string or key. The parameters can be primitive types or combined types. For example you give a monster a parameter "strength" that can be accessed using the string "strength". Not only must there be the ability to access parameters given this name, but it must also be possible to get a list of parameters that exist in the object, so that you can serialize it. So this allows usage in scripts, saving/loading, ... I'm not sure if this is called reflection, or properties, or something else? Reflection might be it, but I don't know if iterating through the parameters without knowing their names beforehand is possible with reflection? I'd like to implement it, but I need to give the interface the correct name of course...

Share this post


Link to post
Share on other sites
Advertisement
it has many names. In c++ the data type you are looking for is called a map. In other languages it can be referred to as a hash or dictionary. Being able to query the internals like that is usually called reflection. C++ doesn't offer reflection but it shouldn't be to hard to write a get properties function that does the same thing.

Share this post


Link to post
Share on other sites
I'm not sure if there is one single correct term for it, but it's a property of reflection in .NET. The designers of python called it introspection. In COM (component object model) that behavior was accessed through an interface called IDispatch, which was necessary to implement late-binding in VB6 and ActiveX script.

Share this post


Link to post
Share on other sites
Reflection, more specifically introspection. Introspection is the querying of some value to obtain metadata. Reflection in general also covers runtime modification of code, etc.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!