logoalt Hacker News

mmastracyesterday at 6:45 PM3 repliesview on HN

Postel's law is considered more and more harmful as the industry evolved.


Replies

CodesInChaosyesterday at 7:18 PM

That depends on how Postel's law is interpreted.

What's reasonable is: "Set reserved fields to 0 when writing and ignore them when reading." (I heard that was the original example). Or "Ignore unknown JSON keys" as a modern equivalent.

What's harmful is: Accept an ill defined superset of the valid syntax and interpret it in undocumented ways.

show 3 replies
n2d4yesterday at 6:49 PM

Very much so. A better law would be conservative in both sending and accepting, as it turns out that if you are liberal in what you accept, senders will choose to disobey Postel's law and be liberal in what they send, too.

show 2 replies
esafakyesterday at 6:54 PM

I think it is okay to accept liberally as long as you combine it with warnings for a while to give offenders a chance to fix it.

show 3 replies