[plt-scheme] required else for if ?
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.