Skip to content

Why PLT Scheme disllows one-armed ifs

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

(via plt)

3 Comments

  1. It wasn’t me; it was the one-armed if!

    (Sorry, I actually have nothing interesting to add)

    Tuesday, September 8, 2009 at 8:03 am | Permalink
  2. Grant wrote:

    Hunter:
    If that was a Twin Peaks reference then you added something interesting ;).

    Tuesday, September 8, 2009 at 8:51 am | Permalink
  3. Ben Simon wrote:

    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.

    Friday, September 11, 2009 at 1:01 pm | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*