Reflection Idea

user at domain.invalid user at domain.invalid
Thu Sep 28 11:28:00 PDT 2006


> 
> FWIW, I have the "dynamically loaded from a supplemental database file" 
> part done.  DDL just uses the map file:
> 
> http://www.dsource.org/projects/ddl/wiki/Tutorial/UsingDDL/Reflect
> 
> //reflect.d
> module reflect;
> import ddl.DefaultRegistry;
> import mango.io.Stdout;
> 
> void test(){
>     Stdout.put("Hello DDL World"c).put(CR);
> }
> 
> void main(){
>     auto registry = new DefaultRegistry();
>     auto inSitu = registry.load("reflect.map");
> 
>     auto testFn = inSitu.getDExport!(void function(),"reflect.test")();
>     testFn();
> }
> 
> It's not as pretty as Java's reflection suite, but IMO, it's only a few 
> wrapper classes away from that level of utility.
> 

Isn't this dynamic binding rather than reflection? I think of reflection 
as the ability to find what the fields and methods are for an object. 
For example, with Java reflection has the following

Class c = someObject.getClass()
c.getFields();
c.getMethods();


Does DDL have the ability to lookup methods and fields? For example, how 
would you determine "reflect.test" without knowing it beforehand?

   Bradley




More information about the Digitalmars-d mailing list