MessagePack for D released
Masahiro Nakagawa
repeatedly at gmail.com
Mon Apr 26 05:34:42 PDT 2010
On Mon, 26 Apr 2010 20:17:56 +0900, davidl <davidl at nospam.com> wrote:
> I hope it can create Dynamic Object when unpack the serialized
> object(once the client doesn't know the exact type of the original
> object or no declaration is available when the compilation is done).
>
> For example:
>
> a plugin DLL
>
> class Plugin{
> int plugin_state;
>
> } // serialize this object and then send to host
>
>
> Host // has no idea of the plugin's declaration
>
> DynamicObject do = unpack(dll_serialized_buffer);
>
> do.plugin_state // it can be done through the opDispatch
>
Umm... I can't image this situation.
On host, How could you know 'plugin_state' name?
I think DynamicObject is difficult.
First idea uses Variant:
-----
struct DynamicObject
{
Variant[string] props;
// cut
Variant opDispatch(string name)()
{
return props[name];
}
}
-----
but this code doesn't work.
See http://d.puremagic.com/issues/show_bug.cgi?id=2451
Any ideas?
More information about the Digitalmars-d-announce
mailing list