On fre, 2012-05-04 at 12:30 -0400, Andrew Dunstan wrote:
> Yeah, what I've been thinking about in conjunction with similar
> problems is some sort of type registry, so that we could code for
> non-builtin types in certain cases.
It certainly seems to come up a lot, but I'm not sure whether the two
main use cases -- mapping types into languages, and mapping types into
JSON (or XML, as an alternative) -- would have the same solution. A
third use case that could be included as well is changing the main text
or binary format of a type (e.g., what datestyle does). So instead of
having just a hard-coded set of typinput/typoutput, typrecv/typsend,
you'd have a catalog of
(context, inputfunc, outputfunc)
and the context would a language, something json or xml, or a
user-settable value. This could become quite complicated, but it sure
could solve a lot of issues in one go.