Reflection Idea

Craig Black cblack at ara.com
Fri Sep 15 08:10:00 PDT 2006


"Pragma" <ericanderton at yahoo.removeme.com> wrote in message 
news:eeclc4$2206$1 at digitaldaemon.com...
> Craig Black wrote:
>> Since DDL provides run-time reflection, and is finally ready to use, I 
>> thought it would be a good time to share my idea to improve performance 
>> when accessing metadata.
>
> Technically DDL does, although I'm hesitant to call it that since it 
> doesn't have all the typical reflection bells-and-whistles yet.

All in due time I'm sure.  At this point, I'd be happy with just the basics.

> The only reason why I'd consider full-on reflection for D a bad move is 
> that it'll bloat program sizes considerably.  This is kind of contrary to 
> D's goal as a systems programming language.  Taking into consideration the 
> sheer size of your average .map file is a good indicator of just how bad 
> things can get.
>
> So I'd caution the addition of adding such a suite to D as something 
> optional if at all possible.  Even something minimalisitc would work - 
> like the inclusion of just a hashtable of all the program's symbols 
> (metadata as Craig put it above) that is *optionally* compiled in.

Yes, optional of coarse.  DDL is a library, not a part of the D compiler.
However, an extra reference per TypeInfo instance shouldn't hurt too bad.
If not using reflection, the reference would simply be null.

> Otherwise, we're stuck with .map/.situ support under DDL - i.e. using your 
> .map file as a runtime dependency for the program.  While this works well, 
> and is such a dead-simple way of addressing the problem, it's also easy to 
> get out of sync IMO.
>
> [PSA]
>
> Craig, if you're at all interested in hammering out a reflection interface 
> (for DDL?), the DDL Community wiki there is open for your, and everyone 
> else's abuse.

I appreciate the offer very much.  However, at the moment I am very busy 
building the
next version of our software, which is written in C++.  I'm waiting on D to 
become
mature enough so that I can pitch it to my boss as something we cannot live 
without.
The first time I mentioned D to him as a useful technology, he asked if it 
provided
reflection, a feature that would be very useful for our product.  I had to 
admit that
it does not provide reflection yet.

It's a hard sale for a number of technical reasons.  I could elaborate, but 
probably
nobody cares all that much.  Anyway, perhaps I will take you up on that 
offer when I
have more time.

-Craig 





More information about the Digitalmars-d mailing list