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

Re: Open-coding, and proliferation of function names

    Date: 4 December 1980 1424-EST (Thursday)
    From: Guy.Steele at CMU-10A

    xxx-IDENTITY -- or even FIX-I and FLO-I (flatfoot FIX-I with a FLO-I 
    FLO-I) -- is too painful to type all over the place, and within their
    limited domain MAX$ and + and >$ are extremely convenient and useful, 
    whether or not they are considered "primitive" or "macro".

Who said anything about typing them all over the place?

You'd do (DECLARE (FIXNUM ...)) for variables, so you'd never need (FIX-I ...)
around a variable except in rare (probably uninteresting) cases where it 
happens to have a fixnum for an instant and you happen to know that.

As for things like (GREATERP (+ I J) K) if K was declared FIXNUM, the rest
would be inferred easily. So in mathy expressions, very few FIX-I's would be
needed either.

As for structure references, you might find (GREATERP (FIX-I (CAR X))
(FIX-I (CAR Y))) pretty ugly, but probably you should have used a typed
data accessor anyway. Eg, (DEFMACRO FOO (X) `(FIX-I (CAR ,X))) so that
you could say (GREATERP (FOO X) (FOO Y)). In fact, if GREATERP and > were
synonymous, you could have said (> (FOO X) (FOO Y)), thus reducing the net
number of chars (if you're into that).

It's probably true that greaterp tests occur often enough that several
flavors for brevity might be nice to provide. I'm not convinced that
this is true, though, of MAX -- a function I have probably only ever
used four or five times in all my Lisp coding. Maybe other people use
MAX more often. But unless someone can show me some real applications
(plural) where MAX is really used more than once or twice a file, I'll
remain unconvinced as to the need for a name split on that function. It
would leave open the question of why there shouldn't be a different
function for SIN of fixnums, for CHAR-UPCASE of chars known to be in the
alphabetic range, for IO from a known SFA, etc. I would like such
declarations to be available, but I don't think that building them into
the names -- except for the most common idioms -- is a good idea.