A good example is Date: I don't want to serialize this as a Json hask with a bunch of integer values, I want to serialize is as an ISO-8601 date.
Conceptually I could do that by supporting pluggable formatters & parsers. The problems come (in the Serializer) when I want to invoke a formatter (in val()):
Basically val() gets called a lot, and this idea relies on being able to look up a user supplied formatter from an instance quickly. But that lookup involves instance→ type →multiple map lookups for inheritance. I don't really want to put that on a hot path.
Worse, I can't even make it work because in val() I have a (static type) Object, it has runtime type T and although I can lookup a Formatter<T> there's no way to invent a static type to represent the runtime type, so even though the invocation is safe, the typechecker can't see that. I need ceylon/ceylon#4465 to solve that efficiently. In the meantime I'm left with the metamodel, which is going to be really slow.
Note to self: This is partially implemented in the string-serializer branch.
A good example is
Date
: I don't want to serialize this as a Json hask with a bunch of integer values, I want to serialize is as an ISO-8601 date.Conceptually I could do that by supporting pluggable formatters & parsers. The problems come (in the
Serializer
) when I want to invoke a formatter (inval()
):val()
gets called a lot, and this idea relies on being able to look up a user supplied formatter from an instance quickly. But that lookup involves instance→ type →multiple map lookups for inheritance. I don't really want to put that on a hot path.val()
I have a (static type)Object
, it has runtime type T and although I can lookup aFormatter<T>
there's no way to invent a static type to represent the runtime type, so even though the invocation is safe, the typechecker can't see that. I need ceylon/ceylon#4465 to solve that efficiently. In the meantime I'm left with the metamodel, which is going to be really slow.Note to self: This is partially implemented in the
string-serializer
branch.