Comment

Comment by chubot

Yes good call, I changed the broken Wikipedia links to the archive page - https://web.archive.org/web/20230228105200/https://people.cs...

Looks like it broke earlier this year, but the rest of his site is still up.

It's very weird that there's already a "canonical" format for s-expressions, and then Racket apparently implemented something incompatible -- BUT WITH THE SAME NAME.

They are both called "csexp".

---

Rivest's draft is filled with a lot of words, but this looks like a clear incompatibility:

A verbatim encoding of an octet string consists of four parts:

-- the length (number of octets) of the octet-string, given in decimal most significant digit first, with no leading zeros.

-- a colon ":"

-- the octet string itself, verbatim.

That's a length prefix. Also, unless my head is exploding, that's 3 parts, not 4.

In contrast, the Racket library uses a length suffix:

Spaces are removed and all strings are suffixed by their size and a colon : separator.

That's super weird. This is really "the curse of Lisp" ...

---

Of course maybe nobody actually uses Rivest's thing. But the length PREFIX is conventional so you know how much to allocate (netstrings, bencode, etc.)

Not sure why they would go with a length suffix -- I've never heard of that.

I could see making it incompatible to improve it, but it doesn't seem improved.

parent chubot 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton