December 03, 2005
Don Clugston wrote:
> By presenting members (of modules, templates, classes and structs, maybe even functions) as an array of constant char [] identifiers and char [] mangled typenames, you could have *full* compile-time reflection.
Compile-time reflection was something I was thinking about too, as it would be very useful. For instance one could make a generic Serialize mixin template that would save any class/struct to a certain media (like a file, or stream).
However, from what I understand from your example above, that method would only give "read-only" reflection as you would only have available the member's names/signature, and, at least for fields (and virtual functions too, I think?), that would not be enough to access it (you would need offset info, right?).

> I suspect this would be by far the easiest way of implementing it, too.
> Although walking the syntax tree before compilation is complete sounds perilous. Could it ever be done safely? (I wonder if any other languages have done it successfully?)
Sounds perilous? Why? And I wouldn't call it "walking the syntax-tree", it's not that permissive.

Bruno Medeiros - CS/E student
"Certain aspects of D are a pathway to many abilities some consider to be... unnatural."
Next ›   Last »
1 2 3
Top | Discussion index | About this forum | D home