On Thursday, 30 May 2013 at 17:24:15 UTC, Steven Schveighoffer wrote:
If you wanted to add interfaces, would you have to modify object.d?

Yeah, but that's not something you'd have to do since you can just subclass it and add whatever you want there.

class MyThing: Reflectable {
  blah whatever;
}

@CustomTypeInfoExtension(new MyThing())
class Test {}


auto info = typeid(Test).rtInfo();
foreach(item; info.customItems)
   if(auto c = cast(MyThing) item) {
    // use c
   }


Or maybe we could implement it like:

MyThing c = typeid(Test).rtInfo().getCustomItem!MyThing();


which could perhaps be used with any type. You could also get compile time info on it easily enough:

class MyThing(T) : Reflectable {}

@CustomTypeInfoExtension(new MyThing!Test())
class Test {}

Reply via email to