Compile-time reflection
Fawzi Mohamed
fmohamed at mac.com
Sat May 31 01:20:43 PDT 2008
I understand the need of reflection t connect D to other languages.
Still I think that a solution to this problem should be (not
necessarily now, but in the future) extensible to template functions.
The virtual/final/static attributes seem quite straightforward and
unproblematic (I like the is(x==virtual) solution because it is what I
would have expected).
The symbol+signature -> function pointer is also unproblematic (be it
through an alias cast or assignment).
The symbol -> signatures thing can be problematic if templates enter in
the picture.
One could think of representing all kind of signatures by allowing things like
template(TemplateType T0){template(alias T1){template(int
T2){template(int T3){T0 function(T0[T2],optional T0[T3])}
or something like it.
Unfortunately this is not enough as there is no guarantee that a given
template is instantiable.
Instantiability can be controlled at compile time, but still for
automatic interface generators one cannot avoid giving them some extra
information.
One could think about giving restricting the list of signatures either
to full specializations (and maybe have some hint that extra ones might
exist), or to the templates that have been instantiated (but such a set
is not fixed and can change from program to program).
In any case some thought should be spent about this.
Fawzi
More information about the Digitalmars-d
mailing list