On Thu, 30 May 2013 10:59:52 -0400, Adam D. Ruppe <destructiona...@gmail.com> wrote:

The compiler instantiates a template called RTInfo!T for every custom type T that is made available through the TypeInfo class (.classinfo, typeid()).

The first idea with this was to do precise GC, but it can do more than just that. Currently, it is totally unused in druntime. I propose we put it to use to allow some runtime reflection.

http://forum.dlang.org/post/op.wcvlmg03eav7ka@localhost.localdomain

and ModuleInfo even has a list of all classes, and all modules in a program, so we could go pretty nuts with runtime stuff here.

I also want ModuleInfo to have an equivalent RTInfo member. Walter agreed at the conference that it was a good idea and should be done. See bug report here:

http://d.puremagic.com/issues/show_bug.cgi?id=10023

What do you all think? It is a pretty minor change to druntime to enable this kind of thing, it wouldn't get in the way of anything else - druntime can still use RTInfo for its own thing when the time comes without a problem - and it seems to me like it could be easily useful and convenient for some tasks.

I would like to see the necessary framework for RTInfo to allow expansion WITHOUT having to modify object.d. I think this can be done, and then it allows anyone to insert whatever they want for RTInfo based on their own needs.

This would set D apart from existing runtime information frameworks, like Java's and C#'s, in that it's expandable, and it's selective (enabling runtime information might be as simple as adding UDAs).

-Steve

Reply via email to