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

Re: I hate IF.



    Nix:
    I hate IF because its positional syntax ...

    Why do I use IF?  ..."(COND ("
    advances the left margin by 7 precious spaces, while "(IF " moves it
    over by only 4.

Many of us ELLISP people have agreed with Bob's arguments for a long time.
I know you all will barf, but maybe if I say it louder this time, you
might listen:

Conditional expressions are one of the most frequent expressions written.
We have special symbols for arithmetic operations (less frequently used),
why not conditionals?

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

or:

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

A number of us use (gasp, heaven forbid, not another unendorsed hack,
and it uses KEYWORDS to boot, well not really keywords):

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

I never have to worry about the asymmetry of IF, never have to worry about
adding in yet another useless level of indentation if I want multiple
expressions in one of the arms, and I find it easier to read than ?  for
simple code.  THEN and ELSE are synonyms for PROGN.  But of course, all
real Lispers are required by law to barf at this, since the pretty printing
doesn't match the low-level list structure (as if there were any
correlation between low-level list structure and the global structure
of the program that the programmer has in his head).

I know, "not Lisp".

    Rees:
    Thus rather than

            (IF pred con . alts)

    the syntax would be

            (IF pred con alt).

Sounds like a very sensible suggestion.
-------