Live data from Hacker News

Uniform eXchange Format (UXF) – plain text human readable typed storage format

github.com

31–40 of 62 posts

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#31
post #29

Likewise, I had a go at trying to improve on JSON and this is my attempt: https://github.com/tlocke/zish Any comments / criticisms gratefully received.

This is very very good. Only thing I can think that it's missing (and maybe you have support for this and I misread your readme) is ordered maps (there's a better name for this but I'm blanking).

For example, imagine I have a compact append only map format and I want to represent it like this (where last tuple wins when you have a duplicate key, but earlier history is preserved)

    {
     score: 0,
     score: 1
    }

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#32
post #12

> Use no for false and yes for true. Wouldn’t it be better to use true for true and false for false?

Could you please elaborate? Why is true a better value than yes? Seems like an arbitrary choice to me. Does one choice have some advantages over the other?

I would say “yes” and “no” are locale specific. Why not German “ja” and “nein”, French “oui” and “non” (with the advantage of being of the same, short, length), etc? Yes, “true” and “false” are English words, but in programming circles, IMO transcend locale.

(The more locale agnostic ⊤ and ⊥ (https://en.wikipedia.org/wiki/Verum and https://en.wikipedia.org/wiki/Up_tack), IMO are a bit elitist and difficult to type)

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#33
post #15

Earlier quoted context omitted.

What timezone do you assume the source datetime is in?

Since there are three incorrect responses to this comment already: Anyone saying “UTC” is wrong . Unambiguously wrong if offsets are supported , and in foolish contexts like this where offsets are not supported, still wrong due to common sense and custom. If there is no offset, there is no offset . It’s what is commonly called a naive or plain datetime. How it should be interpreted is explicitly undefined if offset-c…

If you want to make this a nitpicking discussion about phrasing a provocative statement, sure. If we’re talking about what matters, I stand by the notion that any point in time should be recorded in UTC, full stop. Storing a different time zone only makes sense if something happens at the same time in multiple time zones, but use cases are few. In the vast majority of scenarios,calculating the offset of the client and showing the adjusted date is the correct solution.

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#34
post #4

no time zones on date/&times? they should be added.

Especially on the timestamps, I find some of the design choices a little bit bizarre. Choosing only a strict ISO8601 format: awesome! Choosing to excise critical parts (representing timezones and fractional seconds): very unfortunate. Chesterson's Fence ( https://en.wikipedia.org/wiki/G._K._Chesterton#Chesterton's_... is a very powerful design principle. They chose to put those elements into ISO 8601 for principled r…

Amazon’s Ion[0] uses ISO 8601 including fractional seconds and offsets as its date time format.

0 - https://amzn.github.io/ion-docs/

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#35
I really fail to see the point of this format.

If human readability was the point, then doing something different than expected is a really bad idea:

* "no" and "yes" as boolean values may save some bytes, but the tradeoff isn't worth it (and if filesize matters, use a binary format to begin with). * Using angle braces except of double quotes to fence strings makes the format look noisy and means you have to remember two kinds of escapes if you want to use in the value. * The format isn't object oriented in any way. You can simulate that by putting maps into maps, of course, but no one will have fun reading or writing that in a text editor.

Type information is for parsers, not humans. JSON this this right, Protobuf does this right. UXF is just a compromise combining (only) the disadvantages of the two.

UXF is self contained, that's great, but in 99.9% of the cases where you need a DX format, sender and receiver already know the schema, so that definition block just adds bloat.

You can happily mix lists, maps and tables of primitive or compound types. And since stuff is typed instead of named, order matters and you end up addressing everything through positional parameters. That's going to be fun when using a text editor to write down something like a list of GPS coordinates (you are likely to confuse latitude and longitude).

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#36
post #12

Earlier quoted context omitted.

Could you please elaborate? Why is true a better value than yes? Seems like an arbitrary choice to me. Does one choice have some advantages over the other?

Because even the author uses true to describe what he means by yes.

This is why you should never finalize specs until you've written the documentation for it.

If it sounds stupid when you say it out loud, it _is_ stupid.

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#38
post #27

This seems unnecessarily terse. If you want types, why not make it look like one of the existing popular languages with types? (Rust/TypeScript/protobuf) Instead of: uxf 1 =Database server:str ports:list connection_max:int enabled:bool =DateTime when:datetime tz:str =Owner name:str dob:DateTime =Hosts name:str [ (Owner (DateTime 1979-05-27T07:32:00 )) (Database [8000 8001 8002] 5000 yes) (Hosts ) ] Why not: type Data…

I agree, visually parsing things that are all on one line is more difficult than it needs to be. Putting separate things on separate lines is preferable.

Re: Uniform eXchange Format (UXF) – plain text human readable typed storage format

#39
post #33

Earlier quoted context omitted.

Since there are three incorrect responses to this comment already: Anyone saying “UTC” is wrong . Unambiguously wrong if offsets are supported , and in foolish contexts like this where offsets are not supported, still wrong due to common sense and custom. If there is no offset, there is no offset . It’s what is commonly called a naive or plain datetime. How it should be interpreted is explicitly undefined if offset-c…

If you want to make this a nitpicking discussion about phrasing a provocative statement, sure. If we’re talking about what matters, I stand by the notion that any point in time should be recorded in UTC, full stop. Storing a different time zone only makes sense if something happens at the same time in multiple time zones, but use cases are few. In the vast majority of scenarios,calculating the offset of the client an…

The context was specifically the handling of times that don’t include an offset (or perhaps time zone, it was unclear). The correct answer there is not UTC (which is flatly incorrect, depending on a locally-enforced convention that incidentally deviates from the most common meaning of such time stamps), but rather “don’t enter that situation in the first place, because any other answer is wrong”.

—⁂—

For the rest of your statement: for times not tied to a particular location or time offset, you should always use UTC in the form of the offset Z, in ISO 8601/RFC 3339 terms, since specifying any other offset indicates that it means something. (Note that RFC 3339 tried to have -00:00 be the neutral offset and Z and +00:00 meaningful, but that is acknowledged to have failed, and so https://www.ietf.org/archive/id/draft-ietf-sedate-datetime-e... is updating it to match actual usage.) But for things that involve humans and are anchored to a particular time zone, using UTC and not storing a time zone is wrong: you should store the relevant time zone and (fallback) offset so that if the time zone definition changes (as they do, sometimes with less than a few days’ notice), future times can be corrected, which they can’t be if you anchored them to UTC. So: things like system logs, use UTC; online conferences, use UTC; location-bound conferences, use that location’s time zone; general user calendars, use the user’s time zone; calendars for companies that straddle time zones (or people that work across time zones): deliberately choose a time zone or offset to anchor things to (sometimes at the level of individual events), especially for the sake of recurring event periods if you use a time zone with DST.

Post reply on HN