Common Lisp Compatibility
Top
Porting Common Lisp
Following is a list of all known incompatibilities between this package
and the older Quiroz `cl.el
' package.
This package's emulation of multiple return values in functions is incompatible with that of the older package. That package attempted to come as close as possible to true Common Lisp multiple return values; unfortunately, it could not be 100% reliable and so was prone to occasional surprises if used freely. This package uses a simpler method, namely replacing multiple values with lists of values, which is more predictable though more noticeably different from Common Lisp.
The defkeyword
form and keywordp
function are not
implemented in this package.
The member
, floor
, ceiling
, truncate
,
round
, mod
, and rem
functions are suffixed
by `*
' in this package to avoid collision with existing
functions in Emacs 18 or Emacs 19. The older package simply
redefined these functions, overwriting the built-in meanings and
causing serious portability problems with Emacs 19. (Some more
recent versions of the Quiroz package changed the names to
cl-member
, etc.; this package defines the latter names as
aliases for member*
, etc.)
Certain functions in the old package which were buggy or inconsistent
with the Common Lisp standard are incompatible with the conforming
versions in this package. For example, eql
and member
were synonyms for eq
and memq
in that package, setf
failed to preserve correct order of evaluation of its arguments, etc.
Finally, unlike the older package, this package is careful to
prefix all of its internal names with cl-
. Except for a
few functions which are explicitly defined as additional features
(such as floatp-safe
and letf
), this package does not
export any non-`cl-
' symbols which are not also part of Common
Lisp.
cl-compat
package
The CL package includes emulations of some features of the
old `cl.el
', in the form of a compatibility package
cl-compat
. To use it, put (require 'cl-compat)
in
your program.
The old package defined a number of internal routines without
cl-
prefixes or other annotations. Call to these routines
may have crept into existing Lisp code. cl-compat
provides emulations of the following internal routines:
pair-with-newsyms
, zip-lists
, unzip-lists
,
reassemble-arglists
, duplicate-symbols-p
,
safe-idiv
.
Some setf
forms translated into calls to internal
functions that user code might call directly. The functions
setnth
, setnthcdr
, and setelt
fall in
this category; they are defined by cl-compat
, but the
best fix is to change to use setf
properly.
The cl-compat
file defines the keyword functions
keywordp
, keyword-of
, and defkeyword
,
which are not defined by the new CL package because the
use of keywords as data is discouraged.
The build-klist
mechanism for parsing keyword arguments
is emulated by cl-compat
; the with-keyword-args
macro is not, however, and in any case it's best to change to
use the more natural keyword argument processing offered by
defun*
.
Multiple return values are treated differently by the two
Common Lisp packages. The old package's method was more
compatible with true Common Lisp, though it used heuristics
that caused it to report spurious multiple return values in
certain cases. The cl-compat
package defines a set
of multiple-value macros that are compatible with the old
CL package; again, they are heuristic in nature, but they
are guaranteed to work in any case where the old package's
macros worked. To avoid name collision with the ``official''
multiple-value facilities, the ones in cl-compat
have
capitalized names: Values
, Values-list
,
Multiple-value-bind
, etc.
The functions cl-floor
, cl-ceiling
, cl-truncate
,
and cl-round
are defined by cl-compat
to use the
old-style multiple-value mechanism, just as they did in the old
package. The newer floor*
and friends return their two
results in a list rather than as multiple values. Note that
older versions of the old package used the unadorned names
floor
, ceiling
, etc.; cl-compat
cannot use
these names because they conflict with Emacs 19 built-ins.