On Sat, 01 Oct 2011 06:50:52 -0400, Jacob Carlborg <[email protected]> wrote:
On 2011-10-01 05:00, Robert Jacques wrote:
I agree, which is why I suggested lookup should have some granuality.
i.e. that there is both a global store of serialization methods and a
per instance store of serialization methods. Lookup would first look in
the local store before defaulting to the global store. But this should
be a separate pair of functions.
Aah, now I get it. That's a good idea. The question is what to name the
two functions. Yet another use case for overloading methods on static.
How about overrideSerializer or overloadSerializer?
[snip]
Both
T deserialize (T)();
T deserialize (T)(string key);
have the following example:
class Foo
{
int a;
void fromData (Serializer serializer, Serializer.Data key)
{
a = serializer!(int)("a");
}
}
No, "T deserialize (T)(string key)" has:
a = serializer!(int)("a");
And "T deserialize (T)()" has:
a = serializer!(int)();
Both are correct. This is a complete example of using one of these
methods: https://github.com/jacob-carlborg/orange/blob/master/tests/Custom.d
Let me know if anything is confusing.
Umm... example code for the deserialize method should contain 'deserialize'
somewhere inside it.