Remix.run Logo
marcosdumay 5 days ago

The problem with Postel's law is exactly that the sender is never conservative, and will tend to use any detail that most receivers accept.

somat 5 days ago | parent [-]

So the problem with Postel's law is that people don't follow Postel's law?

marcosdumay 4 days ago | parent [-]

The problem is that it's a prisoner's dilemma. And you can't cooperate on a prisoner's dilemma against the entire world.

ndusart 4 days ago | parent [-]

So, just be as conservative as possible when you produce data and as liberal as possible when you receive something. Your code will then require the least cooperation from *any* other code to be compatible with.

Doing otherwise will require cooperation to adjust on the specificities clients expect, and you fall into the trap of the prisoner dilemna.

marcosdumay 4 days ago | parent [-]

No, when you create a protocol define exactly what you need what is optional and what is an error, and stick to that.

Being liberal on what you accept is a path for disaster.

ndusart 4 days ago | parent [-]

You changed the problem. Postel's law is not about writing the protocol but implementing it.

Sure, protocol should be designed to be as specific as possible but unfortunately these are not always defined up to that point for any good or bad reasons, and we generally are at best just in the implementation side and cannot influence the writing of the protocol, so the Postel's law is the best we can apply to avoid having to cooperate with the rest of the planet.

marcosdumay 3 days ago | parent [-]

From wikipedia:

> The principle is also known as Postel's law, after Jon Postel, who used the wording in an early specification of TCP.

ndusart a day ago | parent [-]

From the mentioned specification:

> TCP implementations should follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others.

Better to look in the sources ;)