Compiler patch for runtime reflection

Jacob Carlborg doob at me.com
Wed Oct 26 01:01:07 PDT 2011


On 2011-10-26 07:59, Kapps wrote:
> I really like Gor's idea of @noreflect for this. You have a network
> class you don't want as easily reversible, or a security class, or
> private fields such as password. You just mark the module, type,
> methods, or fields, as @noreflect. It could even disable compile-time
> reflection if desired.
>
> It would be important, however, to be able to pass a flag to the
> compiler that marks everything as @noreflect. The idea of opt-in
> reflection is just silly. Standard example is a serialization library.
> Oh hey, you wanna serialize a field of type Vector3? Sorry, the person
> forgot to mark it as @reflected. Oh, you wanna serialize these
> properties of some class? Sorry, not reflected. Opt-out is definitely
> the way to go, as it gives the best of all worlds (and removes all
> overhead if you just pass in something like --version=noreflect to dmd).

I agree, than can be SO annoying just because someone forgot to think 
about reflection/serialization.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list