On 30/03/2015 6:06 p.m., bitwise wrote:
This definitely should be a library solution.
In terms of what Andre was suggesting, I think my implementation is 90%
of the way there, so if the will was there to add something like
std.reflection to phobos, it wouldn't be much of a leap.
But it seems silly, to not use code in druntime.
I kind of agree. If I had things my way, all reflection info for all
classes would be compiler generated so that it was guaranteed to be
there for tools, interop and such. If people were really worried about
code bloat, the reflection info could simply be turned off with a
-no-reflection flag or something.
In terms of playing around with the compiler and the type system, I'm
not sure how helpful I could be right now. I'm pretty sure comprehension
will not be a problem, but I've got quite a bit of reading to do before
I'm up to speed with whats going on with dmd and the type system.
I have so many views upon all this, thanks to my new (not released as
not ready) web service framework. But druntime right now is not ready
for proper reflection. There needs to be some modifications to it and
dmd. But mostly druntime for RTInfo.
For example what shouldn't needed to be done. Here is my install
information for my autoconfig system. (Allows for publically importing
any module I want AND handling any symbol that the system has used.
#Install
## Configure per type
RTInfo requires a single modification.
[Based upon a forum
thread](http://forum.dlang.org/post/[email protected]).
```D
template RTInfo(T, string moduleName = __MODULE__)
{
enum RTInfo = cast(void*)0x12345678;
static if (__traits(compiles, {import core.config;})) {
import core.config;
alias checkResult = TypeCheck!(T, moduleName);
}
}
```
## Auto imports
COPY/core/configimports.d needs to be copied to import/core/configimports.d
Also needed is object.di under imports to be modified.
Add ``D public import core.configimports;`` anywhere you want.