def-function-spec-handler

$Revision: 5.0.2.3 $

Macro

Package: EXCL

Arguments: (symbol arglist &body body)

def-function-spec-handler defines a new kind of function spec handler keyed on symbol, a symbol which is the excl:fspec-first of the function spec. The handler must accept three arguments so arglist must be a list of three elements. The arguments are:

  1. The function spec, which may be in internal or external form. The external form is a list of two or three elements.
  2. The operation. The list of operations is given below.
  3. The extra argument. This argument will be used when needed and ignored when not needed. When the operation is setf, for example, the extra argument is the new value.

The body must return an appropriate value for the operation. The operations are:

:validate Return a boolean indicating whether the place named by the spec exists. This must never signal error.
fboundp Return the function if the function is defined and return nil if the function is not defined. An error must never be signaled on a validated function spec.
:setfable A boolean indicating whether setf is allowed.
setf Set the function to the third (extra) argument value.
boundp Boolean whether fmakunbound is allowed. Note that this is not the same meaning as the CL function boundp.
fmakunbound Make the function funbound.
block For certain functions (e.g. setf functions) defun is required to wrap the body in a block with a certain name. This operation must return the name based on the spec and is called by the defun macro and the compiler top level. This is a good place to put an error check for functions that may not be defined by defun.
unintern Detach the function-spec from its "oblist" for potential garbage-collection of the entire function spec. Does not do an fmakeunbound; i.e. if an operation has squirrelled the function-spec away, it remains fully operational, just as unintern of an fboundp symbol still leaves it fboundp.

See 7.0 Function specs in implementation.htm for more information on function specs.

The general documentation description is in introduction.htm. The index is in index.htm.

Copyright (C) 1998-1999, Franz Inc., Berkeley, CA. All Rights Reserved.