def-fwrapper

Produces a form which returns name and defines an fwrapper as a side
effect. This fwrapper is suitable for use as the fwrap-function in a
call to fwrap.

name can be any function spec.

arglist is an ordinary lambda list. All
ordinary lambda list keywords may be used, including
&allow-other-keys, &aux, &key, &optional, and
&rest. If either &key or &rest are present, then the
arglist is automatically forced to be a list. (Note: the current
implementation also forces a list when optional arguments are
specified, because of some potential problems when a not-given
optional argument is setq'd).

Argument accesses are provided for by means of symbol-macrolets,
in a manner that is mostly intuitive. The arguments can simply
be accessed by name, and they can be setq'd under most
circumstances, with exceptions given below. The values of these
setq'd arguments become part of the argument list that is
sent to the next more inner fwrapper.

Exceptions:

If the &rest arg is setq'd, the change only takes place for the
current fwrapper, and is not passed inward. However, any changes
made to the structure of the rest arg (via (setf car) or (setf cdr)
or similar functions) will result in a change that will be passed
inward.

Any &key value that is setq'd will not replace or add the key
value to the arglist that is passed inward, although the change
will be in effect for the duration of the fwrapper.

def-fwrapper is a defining macro like defun

def-fwrapper is a additional
defining macro in Allegro CL, joining the standard defining macros
like defun. Among
other things, this means that the resulting code is wrapped in a block
named by the wrapper name which can be returned
from. As with any defining macro, one can use macroexpand and pprint to see what is actually
happening (you may see a different macroexpansion -- this is shown
only to see how to get a macroexpansion):