SPAM-LOW: Re: [nem-en] Metaphor, staging, typed reflection
Kamil Skalski
kamil.skalski at gmail.com
Sun Jan 7 19:20:22 CET 2007
>
> How would you handle serialization of a plugin with a compile-time
> macro? Let's assume this contrived example is actually useful for some
> reason, ie. user is dynamically loading a plugin from a website, so the
> code must be able to deserialize it at runtime.
>
> The plugin's public interface may be known at compile-time, but the
> internal structure can not be known, as the end user is specifying a
> class unknown at compile-time. This is a truly dynamic situation.
>
This is not a very good example, since you need to instantiate the
object to use reflection on it. I would probably just send the ready
assembly over the wire and place some "Deserialize (byte[])" method in
the interface. Then I could use serialization implementation provided
by assembly (and generated at compile-time on the client/provider of
plugin-side) to instantiate fetched data into objects.
I can think of uses for runtime code generation, like in partial
evaluation, but note that this does not make much use of reflection.
Methaphor would have the advantage here, but because of its static
multi-state compilation, not because of typed reflection capabilities.
Simply - in my opinion if you can generate code basing on reflection
data, you can also do this at compile-time, which is safer.
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list