== Quote from Jonathan M Davis ([email protected])'s article > On Sunday 24 October 2010 12:17:47 Sclytrack wrote: > > Instead of targeting doc files, could dmd create xml files > > for the purpose of runtime reflection, instead of trying to > > go to runtime reflection via __traits. > > > > You can archive these files together with the binary code. > > Create some sort of D package. > > > > I mean C (GNOME) is going with xml files for their introspection. > > http://library.gnome.org/devel/gi/unstable/gi-gir-reference.html > __traits isn't runtime reflection. It's compile time reflection. It's highly > useful in creating templates and string mixins and the like. > If you want runtime reflection, it's possible to use __traits to put together > a > set of functions which hold the traits information to be queried at runtime, > thereby creating your own runtime reflection mechanism (I think that someone > around here has a project which does exactly that actually), but there is no > runtime reflection built into D. > If you wanted to, you could write code which would produce xml files that held > type information which could be read at runtime, but again, since there is no > runtime reflection in D, you'd have to do it yourself. Not to mention, reading > XML is not exactly very efficient given that you'd be both reading a file and > having to deal with parsing text, so I don't know why you'd generally want to > use XML to hold type information. XML has its uses, but usually I'd think that > you'd want runtime reflection to be efficient, and XML isn't going to do that. > - Jonathan M Davis
Maybe the xml data could be converted to some faster loadable format by a tool external to the compiler. D---->xml---->runtime reflection library D---->xml---->[binary files---->runtime reflection library] D---->xml---->More D code. C---->xml---->Wrappers in other languages. C---->xml---->D binding code. D------__traits()---->More D Code
