[racket] Typed racket puzzle (ii)

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Wed Aug 17 12:07:37 EDT 2011

>> Jon Postel summed up contravariance by thinking about HTML: "Be
>> liberal in what you accept, and conservative in what you send."

Did he say this about HTML?  The original quote predates the Web.  I 
think Postel was originally talking about subtle variations in 
lower-level, machine-generated, protocols, and I doubt he would have 
supported the mess that happened with excessively forgiving Web 
browsers.  Mosaic was OK, but then HTML handling started getting crazy 
with Navigator.  As the mess started, nobody put a bad-HTML indicator in 
the status bar, nor refused to display a page that had errors, so we had 
years of mess, and, even today, erroneous HTML is the norm.

This doesn't matter as much now, now that the big huge browsers have 
converged on HTML quirks handling, but then we went and did sloppy again 
with JavaScript, only much worse... Call a function with the wrong 
number of arguments: no problem!  Wrong type: no problem!  Access an 
undefined variable: no problem!  Have the wrong object somewhere and 
access a slot that doesn't exist: oh baby, you know that ain't a 
problem!  Fear does not exist in this dojo, and runtime errors are 
contrary to a can-do attitude!  Identifiers, coming out of nowhere!  
Libraries full of caveats, contortions, and erroneously-handled cases 
that would embarrass an assembly language programmer!  Glorious!  Now 
let's do real app development, including large framework composition, 
with this thing!

The next time you hear an industry programmer assert that Lisps don't 
have static checking or are effectively write-only languages, and it 
turns out that said programmer does use JavaScript-- you should suggest 
a friendly wager of $20 or more, before your counter-argument.

(I have done real work in JS, most recently, a cool browser-based 
animated technical visualization part of a large, mostly Racket-based, 
system.  Even with mitigating JS pitfalls with disciplined coding 
practices, the JS was a pain in the butt, compared to had I been able to 
use Racket for that part.)


Posted on the users mailing list.