traits for function having actual source declaration?

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 1 12:32:45 PDT 2017


On Friday, 1 September 2017 at 18:06:04 UTC, Jonathan M Davis 
wrote:
> [...]
>
> You can use std.meta.Filter if you need to filter anything out 
> of an AliasSeq like this, and whether you should be filtering 
> out those functions is highly dependent on what you're doing - 
> e.g. sometimes, you really want to get your hands on __ctor, 
> whereas other times, that's not at all what you're looking for. 
> But because it gives you everything, you have a choice, whereas 
> if they were filtered out, then any code that needed to know 
> about them would be screwed.
>
> - Jonathan M Davis

I'm working on a runtime reflection library, so there won't be 
any access to the actual type. Any access to constructors will 
have to be done through an interface like these:

class Struct : Reflection {
     size_t size() const;
     void construct(void[] mem);
}

class Class : Reflection {
     Object createInstance() const;
}

The library is basically done, but needs polishing. Also, I'm 
stuck waiting for things like __traits() being allowed to bypass 
protection, which was recently decided upon, but not yet 
implemented (hopefully this hasn't been overturned again).

   Thanks


More information about the Digitalmars-d-learn mailing list