www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ABI Stability?

reply Benji Smith <dlanguage xxagg.com> writes:
I've been thinking about the Java Reflection API and how useful it can
be to change the behavior of an application during runtime. Even
though no such API exists right now for D, I've been looking at the D
ABI page ( http://www.digitalmars.com/d/abi.html ) and thinking that
it wouldn't be difficult for a third-party developer to write a
reflection API using the information from the object's classinfo
property and vtable. Even though much of the ABI is still marked as
TBD, if the ABI is anticipated to remain relatively stable, it would
be possible to build the reflection interface just by referring to the
object.d code in phobos.

Though, even if it would currently be possible to produce a reflection
API using this information, it wouldn't be worth the effort if the ABI
isn't set in stone yet.

So, Walter, how stable is the ABI right now?

--Benji Smith
Dec 20 2004
next sibling parent "Walter" <newshound digitalmars.com> writes:
"Benji Smith" <dlanguage xxagg.com> wrote in message
news:r2ses0t5bn16p40lv21d548dkph4c67p0h 4ax.com...
 I've been thinking about the Java Reflection API and how useful it can
 be to change the behavior of an application during runtime. Even
 though no such API exists right now for D, I've been looking at the D
 ABI page ( http://www.digitalmars.com/d/abi.html ) and thinking that
 it wouldn't be difficult for a third-party developer to write a
 reflection API using the information from the object's classinfo
 property and vtable. Even though much of the ABI is still marked as
 TBD, if the ABI is anticipated to remain relatively stable, it would
 be possible to build the reflection interface just by referring to the
 object.d code in phobos.

 Though, even if it would currently be possible to produce a reflection
 API using this information, it wouldn't be worth the effort if the ABI
 isn't set in stone yet.

 So, Walter, how stable is the ABI right now?
It's pretty well fixed now. I plan on extending classinfo, but that won't change the existing layout and meaning of its current members.
Dec 20 2004
prev sibling parent reply pragma <pragma_member pathlink.com> writes:
In article <r2ses0t5bn16p40lv21d548dkph4c67p0h 4ax.com>, Benji Smith says...
Though, even if it would currently be possible to produce a reflection
API using this information, it wouldn't be worth the effort if the ABI
isn't set in stone yet.
If memory serves, someone had posted up an interim solution here to the NG several months ago. It was a custom tool that created reflection classes and information from the map files that dmd generates. I've tried searching the archives, but I had no luck finding that particular post. I think you're on the right track with coding against the ABI. A preprocessor would be the best approach, IMO, as there's only so much information you can gather from within D at this point. The map-file-based postprocessor approach works too, but the resulting code doesn't mesh as well with the language as one would like. RT: Since Walter is still planning on coding this feature into D properly, perhaps now would be the best time to investigate possible solutions/approaches to reflection in D. Also, this NG has a history of such proposals, so the way ahead may be pretty well mapped out. At least that way, Walter would have the benefit of the community's reaction before he sets out to put it into D properly. ;) - EricAnderton at yahoo
Dec 21 2004
parent Benji Smith <dlanguage xxagg.com> writes:
On Tue, 21 Dec 2004 15:34:42 +0000 (UTC), pragma
<pragma_member pathlink.com> wrote:
I think you're on the right track with coding against the ABI.  A preprocessor
would be the best approach, IMO, as there's only so much information you can
gather from within D at this point.
I think I'd rather focus on designing a really great reflection interface and the coding as much of it up as possible. Whatever remains impossible to code will act as a guide for what types of additional features need to be available from the classinfo property (and through the ABI). I've started sketching together a REALLY skeletal reflection framework on the wiki, here: http://www.prowiki.org/wiki4d/wiki.cgi?ReflectionInD Feel free to tinker with it and add your own suggestions and improvements. At the moment, it primarily includes methods for accessing information about primitives, classes, objects (instances of those classes), methods, etc. What it *doesn't* include yet are any functions for using the reflection API to dynamically *generate* new classes and objects at runtime (simply because I only spent an hour working on it). --Benji
Dec 21 2004