[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mismatch between name of function and what it really does
G> Date: Mon, 19 May 86 12:20 EDT
G> From: Guy Steele <gls@THINK-AQUINAS.ARPA>
G> Subject: coercion of symbols to strings
(Re allowing (COERCE 'X 'STRING) to coerce X to the string "X")
G> ..., and so the general decision was made that
G> string-specific functions would accept symbols, but general sequence
G> functions would not. COERCE was limited to performing, for the most part,
G> sequence coercions and numerical coercions.
This is one of the bad points (in my opinion) of many LISPs, including
CL, functions that are mis-named or otherwise don't do what you'd
except from their name. Examples:
INTERN doesn't internalize things any more, it does something
different which I don't understand (why not use a different name?)
COERCE works only for sequences and numbers, not for arbitrary things
that can obviously be coerced. For the latter you have to use
various other functions whose names you have to individually remember.
NTH may return a tail or the CAR of a tail, may take the list or the
index as first argument, and may take the index starting at 0 or at
1, in various LISPs, and having used several I can never remember
which it is currently this year (why not do what I do, name this and
related functions more explicitly: NTHCDR-LN0 NTHC-LN0 NTHCDR-N0L
NTHC-N0L NTHCDR-LN1 NTHC-LN1 NTHCDR-N1L NTHC-N1L for the 8 possible
variants, each of which is optimal for certain applications?).
I hope (my opinion, of course) the international standards committee
will fix this kind of problem so programmers reading somebody else's
code can have the meaning apparent in most cases from general
programming tradition rather than having to constantly check the
manual to see if the function does what it seems to say it would do.