[racket] in praise of if's mandatory else clause

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Sun May 29 02:17:05 EDT 2011

Anecdote of "if" mandatory else clause being a win...

Porting some "#lang mzscheme" app code to "#lang racket/base", one of 
the tedious tasks is fixing all the "if" syntax that doesn't have an 
else clause.  I decided to fix the "if" forms manually, rather than with 
Emacs macrology, just in case there was anything I didn't just want to 
make an "and".  Doing it manually turned out to be fortunate, since 
Racket has already found *five* independent (i.e., not copy&pasted) 
locations where the programmers clearly intended to do "(if B E1 E2)", 
but instead did something else, usually "(if B E1) E2".  I won't be 
surprised if I find a few more by the time all the code compiles.

Also, I doubt the programmers would have made these oopses, had they 
been using recent DrRacket, which does paren-matching that's hard to 
ignore.  I'm probably going to make Quack force more prominent 
paren-matching than Emacs does by default.  I'll also probably add my 
M-arrow sexp movement key bindings to Quack, to encourage sexp-based 


Posted on the users mailing list.