- From: Cory Benfield <cory@lukasa.co.uk>
- Date: Mon, 1 Aug 2016 13:30:03 +0100
- To: Poul-Henning Kamp <phk@phk.freebsd.dk>
- Cc: Nicolas Mailhot <nicolas.mailhot@laposte.net>, HTTP Working Group <ietf-http-wg@w3.org>
> On 1 Aug 2016, at 11:50, Poul-Henning Kamp <phk@phk.freebsd.dk> wrote: > > No matter what we decide, we cannot change how JSON defined their > dicts, and consequently whatever we do needs to be mapped into JSON, > python, $lang's data models somehow. JSON, sure, but don’t let Python hold you back. All supported versions of Python have an OrderedDict in their standard library. And any Python tool dealing with HTTP has inevitably had to invent something like a CaseInsensitiveOrderedMultiDict in order to deal with HTTP headers, so any tool that’s likely to deal with this kind of thing is already swimming in dictionary representations that we can use for ordering fields in header values. So just to clarify: the lack of ordering in a JSON object is a reasonable problem with using JSON, but that doesn’t mean we can’t use ordered representations in other serialisation formats. Programming languages have all the abstractions required to do this, and it’s just not that hard to write an Ordered Mapping in $LANG that wraps $LANG’s built-in Mapping type. (Hell, some Python interpreters have *all* dicts ordered, such that they define OrderedDict by simply writing “OrderedDict = dict”). Cory
Received on Monday, 1 August 2016 12:30:36 UTC