digitalmars.D.learn - Any equivalent to python's dir(object) in D?
"Chris Piker" <chris hoopjump.com> writes:
Is there any way to get a list of the properties and functions provided by a module or class or generic variable in D at runtime? I've grown quite accustomed to doing the following kinds of exploration in Python. With in the python interperter I can issue:a = some_barely_understood_function() dir(a)...or for some new moduleimport some_new_module dir(some_new_module)The built in function 'dir' is handy as it prints a list of the members of anything. Since there are many odd members in D such as "int.min" and "double.max_exp", how can I a list of all members of "int", or "double"? Right now it feels like I just have to get luckly while searching online for this information. Thanks
May 04 2014
"bearophile" <bearophileHUGS lycos.com> writes:
Chris Piker:Is there any way to get a list of the properties and functions provided by a module or class or generic variable in D at runtime?In D there are various traits to do that a compile-time. Like: http://dlang.org/traits.html#allMembers There are also the Phobos traits: http://dlang.org/phobos/std_traits.html Bye, bearophile
May 05 2014