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
3 thoughts on “Why PLT Scheme disllows one-armed ifs”
It wasn’t me; it was the one-armed if!
(Sorry, I actually have nothing interesting to add)
If that was a Twin Peaks reference then you added something interesting ;).
For about 32 seconds I found this annoying. And then I started to admire just how beautiful my code was with all those (when …) and (unless …) blocks.
It was absolutely clearer.
And then I was sold.