[plt-scheme] required else for if ?

From: John Clements (clements at brinckerhoff.org)
Date: Tue Sep 8 13:06:40 EDT 2009

On Sep 6, 2009, at 3:43 PM, Matthias Felleisen wrote:

> In 1991 I asked Bob Hieb (Kent's Chez Scheme buddy then, and my co- 
> researcher on theoretical stuff) what the most frequent annoying bug  
> was in the code. He ranked an accidentally omitted else branch among  
> the top three. Indeed, he said that because of this, they had agreed  
> to use WHEN and UNLESS exclusively for cases when they needed a one- 
> armed IF and that they considered all one-armed uses as a bug or a  
> legacy issue (which they corrected as soon as they touched a file).
> We have chosen to codify their restriction. It's a minor  
> inconvenience that buys a good deal of clarity.

A much more evil manifestation of this occurs when you have a one- 
armed if, e.g.:

(if button-is-pressed?

... and it's not working, so you stick a printf in there:

(if button-is-pressed?
   (printf "x = ~v\n" x)

And suddenly the missiles launch without the button being pressed.

Stupid, yes, but I've spent at least one late night tracking down this  


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090908/4983bf84/attachment.p7s>

Posted on the users mailing list.