Mbstring and user-defined datatypes

Nice to see useful classes like mbstring appearing in the library.

I have a few object classes that would be better deployed as data types but one challenge I constantly face is moving the objects between the agent and device. Would it be possible to support some sort of metamethods that allow user-defined data-type instances to be serialised and deserialised so that they can be passed between agent/device? We can obviously move strings, blobs, arrays, tables etc between agent/device without worrying about how it’s done. If a class supports serialisation, we should be able to do the same with it.

By passing an instance from one to the other it would be magically instantiated at the other end by the deserialiser. To pull this off, the class would have to be defined in both agent and device, otherwise a run-time error would be expected.