-(defstruct (bogo-function
- (:alternate-metaclass sb-kernel:funcallable-instance
- sb-kernel:funcallable-structure-class
- sb-kernel:make-funcallable-structure-class)
- (:type sb-kernel:funcallable-structure)
- (:copier nil))
- (walker-info (required-argument) :type list))
-
-(defun walker-info-to-bogo-function (x)
- (make-bogo-function :walker-info x))
-
-(defun bogo-function-to-walker-info (x)
- (bogo-function-walker-info x))
-
-(defun with-augmented-environment-internal (env functions macros)
+;;; a unique tag to show that we're the intended caller of BOGO-FUN
+(defvar *bogo-fun-magic-tag*
+ '(:bogo-fun-magic-tag))
+
+;;; The interface of BOGO-FUNs (previously implemented as
+;;; FUNCALLABLE-INSTANCEs) is just these two operations, so we can do
+;;; them with ordinary closures.
+;;;
+;;; KLUDGE: BOGO-FUNs are sorta weird, and MNA and I have both hacked
+;;; on this code without quite figuring out what they're for. (He
+;;; changed them to work after some changes in the IR1 interpreter
+;;; made functions not be built lazily, and I changed them so that
+;;; they don't need FUNCALLABLE-INSTANCE stuff, so that the F-I stuff
+;;; can become less general.) There may be further simplifications or
+;;; clarifications which could be done. -- WHN 2001-10-19
+(defun walker-info-to-bogo-fun (walker-info)
+ (lambda (magic-tag &rest rest)
+ (aver (not rest)) ; else someone is using me in an unexpected way
+ (aver (eql magic-tag *bogo-fun-magic-tag*)) ; else ditto
+ walker-info))
+(defun bogo-fun-to-walker-info (bogo-fun)
+ (declare (type function bogo-fun))
+ (funcall bogo-fun *bogo-fun-magic-tag*))
+
+(defun with-augmented-environment-internal (env funs macros)