[plt-scheme] required else for if ?

From: Grant Rettke (grettke at acm.org)
Date: Tue Sep 8 21:03:52 EDT 2009

On Tue, Sep 8, 2009 at 12:06 PM, John Clements<clements at brinckerhoff.org> wrote:
> A much more evil manifestation of this occurs when you have a one-armed if,
> e.g. :
>
> (if button-is-pressed?
>  (launch-missiles))
>
> ... and it's not working, so you stick a printf in there:
>
> (if button-is-pressed?
>  (printf "x = ~v\n" x)
>  (launch-missiles))
>
> And suddenly the missiles launch without the button being pressed.
>
> Stupid, yes, but I've spent at least one late night tracking down this bug.

This is a common "enterprise" bug. If I had my way everyone's static
analysis tools would prevent this at work.


Posted on the users mailing list.