Re: A structured format for dates?

+1 to Mark’s arguments, and this is why I’m also in favor of the textual serialization.

It feels like the calls for using an integer serialization are an optimization of something that would be better suited to another format, like binary fields.

For a similar strawman, things like lists and dictionaries could have had more compact serializations (no whitespace, length encoding, etc), but they are instead human-readable structures that are easy to visually parse. That’s what I’d want from a Date field type.

I think the previous PR cut the right balance between having a very precise underlying data model (it’s an integer from epoch) and a human-readable form (a strict serialization and parsing rule set), and kept open the door to the compact optimization that’s being argued for in this thread. I would personally rather we go with that model as opposed to tightly tying together the data model and serialization like is being suggested.

 — Justin

> On Aug 23, 2022, at 11:11 PM, Mark Nottingham <mnot@mnot.net> wrote:
> 
> Personal response - 
> 
>> On 23 Aug 2022, at 11:27 pm, Tommy Pauly <tpauly@apple.com> wrote:
>> 
>> The numeric type is not only simpler to process for a computer, but also should be generally smaller on the wire, particularly if we have binary structured fields one day. The scale of that alone can have a great impact.
> 
> It's important to remember that if/when we have binary structured fields, the binary wire representation can be different from the textual one we're defining now -- for example, it could be the same as that of an integer, but with a different type flag. 
> 
> What we're defining now is merely what the _textual_ (HTTP/1.1-ish) representation of a date is. The underlying data model for dates is separable (see below), as is its mapping to other serialisations of structured types.
> 
>> I imagine it’s also a lot easier to translate *to* the human readable / localized format for a date from the number, since the number is an unambiguous form. Parsing dates the other way (from human readable to machine readable) is where much of the complexity and ambiguity arises, so a scheme that only requires transformations in one direction seems preferable. 
> 
> That entirely relies upon the precision of the underlying data model and the rules for transforming it to/from the textual representation. In the previous PR, the underlying data model was an integer, and the rules were fairly precise, so I don't think this is a strong reason to go this way.
> 
> This is why I'm not terribly convinced by the arguments for an integer textual representation so far; I think we can have the best of both worlds (integer data model / human-friendly textual representation) *if* we believe that binary structured fields are going to happen. IMO the only reason we'd choose an integer textual representation is if we didn't believe that. 
> 
> Cheers,
> 
> --
> Mark Nottingham   https://www.mnot.net/

> 
> 

Received on Wednesday, 24 August 2022 16:32:51 UTC