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

PROG1 as a function

One of our users noticed today that Symbolics defines PROG1 as a
function, rather than as a macro as CLtL specifies.  The definition is

	(defun prog1 (first-form &rest rest-forms)
	  (declare (ignore rest-forms))

This works because CL requires left-to-right evaluation of function
arguments; it just does a bit more consing than a macro implementation
would need to do.  The compiler open-codes PROG1 invocations, so this is
only used in the interpreter.

Does this seem valid?  The only implementation leeway CLtL mentions is
that macros may be implemented as special forms, so long as an
equivalent macro definition is also made available; it doesn't
specifically mention implementing macros as functions (probably because
the developers thought that none of them COULD be implemented as

I don't see how this could cause any code to fail.