4 ms·
> Postel's law is a good indicator of how robust a language is: the more a language is able to make sense of different types of input, the more robust the langu
by pwdisswordfishc 3y ago
> Postel's law is a good indicator of how robust a language is: the more a language is able to make sense of different types of input, the more robust the language.
Into the trash it goes.
Seriously, the avoid-crashing-at-all-costs anti-pattern is what made HTML, JavaScript and PHP the messes that they still are, from which the latter one is only now recovering at a glacial pace. For once, we could learn the lesson.
- HideousKojima 3y agoEvery time I hear Postel's Law mentioned all I can think is "God forbid we actually expect people to correctly implement a spec." I mean I could kind of get it if the specification is poorly written/ambiguous, but that's a problem with the spec itself in that case. Otherwise it's just adding unneeded complexity (that can majorly harm performance) for no real gain, except that you accommodate the people too incompetent to correctly implement a spec.
- djha-skin 3y ago> Postel’s Law about being “conservative in what you emit and liberal in what you accept” is quite frankly not a good engineering principle. -- Joel Spolsky[1] 1: https://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/ https://www.joelonsoftware.com/2003/10/08/the-absolute-minim...
- mongol 3y agoHas Postel himself backtracked though? Because while Joel is an authority of sorts, Postel was too...
- coldtea 3y agoThat would be relevant if the criterion was "what some authority believes". Joel merely states what reality showed about Postel's law over decades. It's a thing developers know from experience, if Joe Random had said the above quote, it would still be true.
- mongol 3y agoThe success of internet's core protocols tells a different story
- coldtea 3y agoEverything can be a success if its the only game in town or a free option, even Javascript. And we shouldn't conflate adoption success with design quality either. That said, it's not like TCP is a great example of Postel's law, and surely not in the crude way it's understood and practiced by its advocates. The RFC says: "As a simple example, consider a protocol specification that contains an enumeration of values for a particular header field -- e.g., a type field, a port number, or an error code; this enumeration must be assumed to be incomplete. Thus, if a protocol specification defines four possible error codes, the software must not break when a fifth code shows up. An undefined code might be logged (see below), but it must not cause a failure." Which is hardly the "anything goes" ticket people imagine it to be. E.g. TCP would still break on a badly formed header and consider it an error. Besides, the advice is good for a transmission control protocol, especially one involving in-between nodes that will not care for the enumeration values like ports and such like the start/end nodes do, and just need to pass them through. It's horrible for other types of software. Language parsing would be a great example where it should not be followed. And of course the most famous related shit show is HTML handling in browsers. HTML might be succesful, but it's hardly because of following the Postel principle.
- mongol 3y ago> HTML might be succesful, but it's hardly because of following the Postel principle. I think if webbrowsers were not lenient with HTML parsing the web would have been adopted much slower in the initial years. Also, HTML5 can be seen as a confirmation that XHTML2 with a strict parsing would not be successful. I followed the WHATWG mailing lists quite closely when that effort began. This is evidence for the applicability of Postel's law at least in the case of HTML.
- zaphar 3y agoNearly all of the internet's core protocols reject bad/malformed packets. They don't do a best effort to figure out what the sender "intended" they just reject the packet. Some of the most popular instances of doing a best effort to figure out the intent of the sender are also poster children for protocol level security flaws. If we've learned anything from deploying, managing, and developing on top of the core internet protocols it's this: 1. Be very conservative in what you send. 2. Reject anything that isn't what you expected to get. If you squint you can sort of see that being a valid interpretation of Postel's law but it's not the standard interpretation in practice.
- nayuki 3y agoThe leniency of HTML burned me a lot in my beginner days. At some point, I decided to switch to XHTML (serving as the media type "application/xhtml+xml") and never looked back. Ditto JavaScript, the laxness harmed a lot, and only like 15 years later did I prepend "use strict" to every script.
- indymike 3y ago> Seriously, the avoid-crashing-at-all-costs anti-pattern is what made HTML, JavaScript and PHP the messes that they still are Forgiving syntax made HTML and PHP easy, and because it was easy people were quick to learn and use them. Everything is trade-offs.
- HideousKojima 3y agoClear and sane error messages (i.e. something with the level of quality of Rust's compiler) could have accomplished the same thing without creating the insanity we have now.
- Aaargh20318 3y ago> and because it was easy people were quick to learn and use them and then went on to write a shitload of insecure code. Just because it's simple to use, doesn't mean that just anyone should be using it. The problem with PHP is that it can be used by someone with far below average programming skills to make something functional. But the flip side of how forgiving it is, is that it takes someone of above average skill to make something to use it to make something safe and performant. Making it easy to use wrongly also makes it harder to use it right. Simply because you lack any feedback when you do something dumb.
- afavour 3y ago> what made HTML, JavaScript and PHP the messes that they still are Also arguably the three most popular ways anyone got into programming in the last couple of decades. Something worth pondering on.
- Diggsey 3y agoBecause for a long time if you wanted to build a website with no money and no experience those were your only options! JavaScript and HTML for obvious reasons. PHP because if you didn't have your own server, you couldn't run anything else (while there were free hosting providers that would host your PHP scripts). Nowadays there are tons more options.
- toxik 3y agoLisp was a thing before PHP, and software engineers did use it but it never reached the popularity of PHP. It is in the end a question of being pragmatic, which PHP and Perl are.