[archived content]

Note: this code is now obsolete with newer versions of D. You can use std.traits in place of this library. The original code is left here for historical interest :)

ftype is a simple template module which can be used to inspect functions at compile-time and run-time. It can tell you the number of arguments a function has, what its return type is, or what the type of any of its positional arguments are.

Because D does not support static loops or variadic templates, the module must be generated from a Python script. If you do not have Python installed, each release comes with a pre-generated module with support for up to 10 arguments, and a set of unit tests.

Both the Python script and the pre-generated modules are released to the public domain, so feel free to do whatever you please with them; I ask only that you attribute me for my work (and that's the "pretty please" kind of asking, not the "legally binding" kind).

To contact me, direct your emails to "daniel" DOT "keep" AT "gmail" DOT "com".

I hope you find this useful.


Page last modified on January 14, 2007, at 10:13 AM