On 22-10-2011 15:20, Andrej Mitrovic wrote:
On 10/22/11, Vladimir Panteleev<vladi...@thecybershadow.net>  wrote:
On Sat, 22 Oct 2011 13:50:32 +0300, Alex Rønne Petersen
<xtzgzo...@gmail.com>  wrote:

You could just introduce a -reflection switch to include reflection
information.

As I mentioned in the previous thread on the subject, I think that ideally
we should improve compile-time reflection so it's possible to generate
runtime reflection information at compilation time. Something like this:

import reflection;

enum reflectionForStdStdio = generateReflectionForModule("std.stdio");

void main()
{
      reflectionForStdStdio.callFunction("writeln", "Hello, world!");
}

--
Best regards,
   Vladimir                            mailto:vladi...@thecybershadow.net


I think user properties would be a perfect fit for this. :)

@reflected
struct Foo {}

The only downside with either approach is that people need to explicitly mark their types as "reflectable", which can be a slight hindrance in the way of discoverability (and probably also complicates actual reflection - what if you try to get the return type of a reflected method and that type is not available? This would make for an *awful* lot of null checks).

In any case, if we need to mark stuff as reflectable in-source, I'd vouch for @reflected, though I would really prefer application-global reflection info.

- Alex

Reply via email to