1. 27

  2. 5

    I find this works pretty well in practice. EDN and transit are two s-expression based formats that come from Clojure, but have libraries available in a variety of languages as well.

    1. 4
      1. 2

        Interesting idea, but it doesn’t distinguish between an empty bytestring and an empty list.

        1. 1

          As far as I can see, it doesn’t have any notion of “byte”. But for normal strings, it’s a string of length 0.

          1. 2

            It’s length-prefixed, like the canonical S-expressions which inspired it, and mentions byte equivalency, so I think it has to be byte-oriented.

            It’s a notation for lists represented as dotted pairs, but its pair notation can’t be used directly because there’s no way to distinguish ("a") from ('a" . ""). With normal NIL-terminated lists that’s okay, because NIL is special in a way that I think the empty string is not.

            But maybe I’m wrong.

            1. 1

              Unless I am completely missing something, this is what I have come up with:

              ("a" . ""):
              1. 2

                Ah, I was looking at his basic format, not the extended one.

                1. 1

                  The extended one is definitely the interesting one :)