[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I hate IF.

Consider the following code:

    (IF (> X Y)
        (SET MAX X)
        (SET MAX Y)
        (FORMAT SO "Oh no, Y was bigger~&"))

When does MAX get SET to Y?  Who can tell.  Compare it to this:

    (IF ((> X Y)
         (SET MAX X))
         (SET MAX Y)
         (FORMAT SO "Oh no, Y was buffer~&")))

I hate IF because its positional syntax makes programs written with
it very difficult to read, and dangerous to edit.  (You probably
wouldn't write the IF form above, but you might edit an existing IF
into something like it.)  I cringe whenever I see an IF with an else

Why do I use IF?  I use it for pretty-printing purposes:  "(COND ("
advances the left margin by 7 precious spaces, while "(IF " moves it
over by only 4.  But, as far as I can see, this is the only thing that
IF has going for it.

I propose that T discard its current definition of IF, and instead
adopt IF as a synonym for COND.

Alternatively, how about taking a step back to FORTRAN and remove IF's
ELSE clause?  Make IF's syntax (IF PREDICATE &THEN-FORMS).

Please don't object to this on the grounds of incompatibility with
other dialects of LISP; T has made no real effort to be compatible,
and besides, this is exactly the sort of incompatibility that can be
handled trivially.