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

primitives



I am somewhat concerned about the lack of primitives in Common-Lisp.
Usually the Common Lisp language design has been oriented toward
high-level features.  This is good, but it is not sufficient.  For
example, DEFCONSTANT was defined at a high-level; people thought about
what they wanted to write in their source programs and specified that as
the behavoir of DEFCONSTANT.  What bothers me is that no facilities were
provided so that the user could write DEFCONSTANT (or more likely, a
variant thereof) himself.  In this example, there is no function that
examines or sets a symbols constantness.  A recent proposal has asked
for CONSTANTP; if (SETF (CONSTANTP 'X) ...) also works, then I would be
satisfied in this case.

I think that are a number of other cases like this one.  We should take
a close look at the next language manual sent to us and try to identify
those high-level parts of the language that should be suplemented by
low-level primitives.  A good way to locate these is to look for
facilities that work only for unevaluated arguments (such as
DEFCONSTANT) or exist at only one of several levels of abstraction (such
as the compiler).

Some more examples:

- A lower-level interface to the compiler should exist.  How about
  something that takes a lambda expression and some other things (e.g. a
  name for debugging) and returns a compiled code object.

- I think DEFUN/DEFMACRO/DEFTYPE should be definable by the user in
  terms of functions with evaluated arguments.  They should be part of a
  Common Lisp library, and not implementation dependent.
  The recent suggestion to expand
  (DEFUN F ARGS BODY)
  into
  (SETF (SYMBOL-FUNCTION-VALUE 'F) #'(LAMBDA ARGS BODY))
  is simplistic, but this is not a fatal flaw.  There should be a
  function (ie. something that evaluates its arguments) like the LISPM's
  FDEFINE or FSET-CAREFULLY or whatever that sets a function cell with
  all the hair of remembering source files and giving warnings and
  whatever other objections were given against the simple SETF.

- Dynamic binding.  PROGV comes close to being a primitive, but is
  cumbersome and only works for the value cell of symbols.