Arnt Gulbrandsen
About meAbout this blog
2013-05-20

Postel's principle

Be conservative in what you send and liberal in what you accept does not mean what you probably think it does.

Jon Postel was talking about how to interpret RFCs. He was, after all, the RFC editor. When an RFC says that a particular protocol uses text lines with a maximum length of 512 bytes and CRLF as line terminators, you might be forgiven for wondering whether that's 510+2 or 512+2 bytes. In most cases there is some sentence that makes it clear, but that sentence can be easy to overlook.

If you overlook it, or you see it but think other implementers may overlook it, then Postel's Principle applies. In the example above being liberal means accepting 512 bytes plus CRLF, and being conservative means sending 512 including CRLF.

Postel's principle does not mean that you should accept 1024-byte lines or any other thing which the RFC forbids. Jon Postel was the RFC editor, he didn't want you to ignore the RFC's stated line length. His principle is about how to handle the boundary case whenever the boundary is underspecified or misunderstandable.

2013-05-09

Selfhosting at last

An announcement of no particular importance:

Today is called ascension, and appropriately in my case, because something ascended today. My little parser generator now selfhosts. It uses a parser generated by itself to parse its grammar file.

I've been hacking on the thing for almost three and a half years, with glacial progress, so I'm very happy. Elated, even.

2013-05-08

Someone should

The should rules went out of fashion at Trolltech after I left. I don't know when, but some people who started in 2006 didn't learn them.

Which is a pity, they were good rules and in my opinion they still are.

The rules were: In a meeting (which at early-Trolltech usually meant over lunch), the phrase we should … meant I will …, and someone should … meant I immediately will ….

The rationale for this is what we should and someone should was weasel wording for I think we should …, but I know I can't persuade anyone else to take on the work. Often (but far from always) noone else thought the result was important enough to justify the working time. Sometimes there were many other reasons. But the reasons don't matter, the results matter, and the should rules made people speak more realistically.

For what it's worth, the rules were suggested by Paul Olav Tvete.