[racket-dev] Racket docs and data-driven design

From: Shriram Krishnamurthi (sk at cs.brown.edu)
Date: Fri Sep 16 12:49:52 EDT 2011

In addition to what Jay said, when the datatype evolves, it's harder
for someone reading the code to tell whether the "else" was meant to
cover only one other case (and now there's two, and someone forgot to
update the function) or truly all the other cases.

When you have crisp predicates, I see no excuse for using else -- it's
intellectually sloppy and causes both missed early-errors (as Jay
shows) and later pain.  For really complex predicates, it makes sense:

  [(prime (foo (bar x))) ...]
  [else ...])

offers many advantages over

  [(prime (foo (bar x))) ...]
  [(not (prime (foo (bar x)))) ...])


Posted on the dev mailing list.