[racket] in praise of if's mandatory else clause

From: Richard Cleis (rcleis at mac.com)
Date: Sun May 29 22:45:26 EDT 2011

On May 29, 2011, at 8:01 PM, Grant Rettke <grettke at acm.org> wrote:

> On Sun, May 29, 2011 at 1:17 AM, Neil Van Dyke <neil at neilvandyke.org> wrote:
>> Doing it manually turned out to be fortunate, since Racket has
>> already found *five* independent (i.e., not copy&pasted) locations where the
>> programmers clearly intended to do "(if B E1 E2)", but instead did something
>> else, usually "(if B E1) E2".  I won't be surprised if I find a few more by
>> the time all the code compiles.
> 
> One of the few code inspections that we do on the CI server for our
> Java and .NET systems (virtually all of our billable work) is to
> forbid one-armed if statements; they are always a source of trouble.
> 
I had been converting every 'if' I see from my early days of scheming, into 'cond.' The else-enforcement now makes 'if' acceptable, but I sometimes still prefer cond, when, and unless due to the implied-begin consistency in all three... and the overt possibility of void returns in the latter two.

Can you effectively forbid programming constructs in your programming group? From what planet do they hail? :)

rac
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users



Posted on the users mailing list.