Fix grammar in lossage message
[sbcl.git] / src / code / macros.lisp
blob7e5587eefd4edd83b099b7ad3df506fc654f8e7b
1 ;;;; lots of basic macros for the target SBCL
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!IMPL")
14 ;;;; ASSERT and CHECK-TYPE
16 ;;; ASSERT is written this way, to call ASSERT-ERROR, because of how
17 ;;; closures are compiled. RESTART-CASE has forms with closures that
18 ;;; the compiler causes to be generated at the top of any function
19 ;;; using RESTART-CASE, regardless of whether they are needed. Thus if
20 ;;; we just wrapped a RESTART-CASE around the call to ERROR, we'd have
21 ;;; to do a significant amount of work at runtime allocating and
22 ;;; deallocating the closures regardless of whether they were ever
23 ;;; needed.
24 ;;;
25 ;;; ASSERT-ERROR isn't defined until a later file because it uses the
26 ;;; macro RESTART-CASE, which isn't defined until a later file.
27 ;;;
28 (sb!xc:defmacro assert (test-form &optional places datum &rest arguments
29 &environment env)
30 #!+sb-doc
31 "Signals an error if the value of TEST-FORM is NIL. Returns NIL.
33 Optional DATUM and ARGUMENTS can be used to change the signaled
34 error condition and are interpreted as in (APPLY #'ERROR DATUM
35 ARGUMENTS).
37 Continuing from the signaled error using the CONTINUE restart will
38 allow the user to alter the values of the SETFable locations
39 specified in PLACES and then start over with TEST-FORM.
41 If TEST-FORM is of the form
43 (FUNCTION ARG*)
45 where FUNCTION is a function (but not a special operator like
46 CL:OR, CL:AND, etc.) the results of evaluating the ARGs will be
47 included in the error report if the assertion fails."
48 (collect ((bindings) (infos))
49 (let* ((func (if (listp test-form) (car test-form)))
50 (new-test
51 (if (and (typep func '(and symbol (not null)))
52 (not (sb!xc:macro-function func env))
53 (not (sb!xc:special-operator-p func))
54 (proper-list-p (cdr test-form)))
55 ;; TEST-FORM is a function call. We do not attempt this
56 ;; if TEST-FORM is a macro invocation or special form.
57 `(,func ,@(mapcar (lambda (place)
58 (if (sb!xc:constantp place env)
59 place
60 (with-unique-names (temp)
61 (bindings `(,temp ,place))
62 (infos `(list ',place ,temp))
63 temp)))
64 (rest test-form)))
65 ;; For all other cases, just evaluate TEST-FORM
66 ;; and don't report any details if the assertion fails.
67 test-form))
68 (try '#:try)
69 (done '#:done))
70 ;; If TEST-FORM, potentially using values from BINDINGS, does not
71 ;; hold, enter a loop which reports the assertion error,
72 ;; potentially changes PLACES, and retries TEST-FORM.
73 `(tagbody
74 ,try
75 (let ,(bindings)
76 (when ,new-test
77 (go ,done))
78 (assert-error ',test-form (list ,@(infos))
79 ',places ,datum ,@arguments))
80 ,@(mapcar (lambda (place)
81 `(setf ,place (assert-prompt ',place ,place)))
82 places)
83 (go ,try)
84 ,done))))
86 (defun assert-prompt (name value)
87 (cond ((y-or-n-p "The old value of ~S is ~S.~
88 ~%Do you want to supply a new value? "
89 name value)
90 (format *query-io* "~&Type a form to be evaluated:~%")
91 (flet ((read-it () (eval (read *query-io*))))
92 (if (symbolp name) ;help user debug lexical variables
93 (progv (list name) (list value) (read-it))
94 (read-it))))
95 (t value)))
97 ;;; CHECK-TYPE is written this way, to call CHECK-TYPE-ERROR, because
98 ;;; of how closures are compiled. RESTART-CASE has forms with closures
99 ;;; that the compiler causes to be generated at the top of any
100 ;;; function using RESTART-CASE, regardless of whether they are
101 ;;; needed. Because it would be nice if CHECK-TYPE were cheap to use,
102 ;;; and some things (e.g., READ-CHAR) can't afford this excessive
103 ;;; consing, we bend backwards a little.
105 ;;; CHECK-TYPE-ERROR isn't defined until a later file because it uses
106 ;;; the macro RESTART-CASE, which isn't defined until a later file.
107 (sb!xc:defmacro check-type (place type &optional type-string
108 &environment env)
109 #!+sb-doc
110 "Signal a restartable error of type TYPE-ERROR if the value of PLACE
111 is not of the specified type. If an error is signalled and the restart
112 is used to return, this can only return if the STORE-VALUE restart is
113 invoked. In that case it will store into PLACE and start over."
114 ;; Detect a common user-error.
115 (when (and (consp type) (eq 'quote (car type)))
116 (error 'simple-reference-error
117 :format-control "Quoted type specifier in ~S: ~S"
118 :format-arguments (list 'check-type type)
119 :references (list '(:ansi-cl :macro check-type))))
120 ;; KLUDGE: We use a simpler form of expansion if PLACE is just a
121 ;; variable to work around Python's blind spot in type derivation.
122 ;; For more complex places getting the type derived should not
123 ;; matter so much anyhow.
124 (let ((expanded (%macroexpand place env)))
125 (if (symbolp expanded)
126 `(do ()
127 ((typep ,place ',type))
128 (setf ,place (check-type-error ',place ,place ',type ,type-string)))
129 (let ((value (gensym)))
130 `(do ((,value ,place ,place))
131 ((typep ,value ',type))
132 (setf ,place
133 (check-type-error ',place ,value ',type ,type-string)))))))
135 ;;;; DEFINE-SYMBOL-MACRO
137 (sb!xc:defmacro define-symbol-macro (name expansion)
138 `(eval-when (:compile-toplevel :load-toplevel :execute)
139 (sb!c::%define-symbol-macro ',name ',expansion (sb!c:source-location))))
141 (defun sb!c::%define-symbol-macro (name expansion source-location)
142 (unless (symbolp name)
143 (error 'simple-type-error :datum name :expected-type 'symbol
144 :format-control "Symbol macro name is not a symbol: ~S."
145 :format-arguments (list name)))
146 (with-single-package-locked-error
147 (:symbol name "defining ~A as a symbol-macro"))
148 (let ((kind (info :variable :kind name)))
149 (case kind
150 ((:macro :unknown)
151 (when source-location
152 (setf (info :source-location :symbol-macro name) source-location))
153 (setf (info :variable :kind name) :macro)
154 (setf (info :variable :macro-expansion name) expansion))
156 (error 'simple-program-error
157 :format-control "Symbol ~S is already defined as ~A."
158 :format-arguments (list name
159 (case kind
160 (:alien "an alien variable")
161 (:constant "a constant")
162 (:special "a special variable")
163 (:global "a global variable")
164 (t kind)))))))
165 name)
167 ;;;; DEFINE-COMPILER-MACRO
169 (sb!xc:defmacro define-compiler-macro (name lambda-list &body body)
170 #!+sb-doc
171 "Define a compiler-macro for NAME."
172 (legal-fun-name-or-type-error name)
173 (when (and (symbolp name) (special-operator-p name))
174 (error 'simple-program-error
175 :format-control "cannot define a compiler-macro for a special operator: ~S"
176 :format-arguments (list name)))
177 ;; DEBUG-NAME is called primarily for its side-effect of asserting
178 ;; that (COMPILER-MACRO-FUNCTION x) is not a legal function name.
179 (let ((def (make-macro-lambda (sb!c::debug-name 'compiler-macro name)
180 lambda-list body 'define-compiler-macro name
181 :accessor 'sb!c::compiler-macro-args)))
182 `(progn
183 (eval-when (:compile-toplevel)
184 (sb!c::%compiler-defmacro :compiler-macro-function ',name t))
185 (eval-when (:compile-toplevel :load-toplevel :execute)
186 (sb!c::%define-compiler-macro ',name ,def)))))
188 (eval-when (#-sb-xc :compile-toplevel :load-toplevel :execute)
189 (defun sb!c::%define-compiler-macro (name definition)
190 (sb!c::warn-if-compiler-macro-dependency-problem name)
191 ;; FIXME: warn about incompatible lambda list with
192 ;; respect to parent function?
193 (setf (sb!xc:compiler-macro-function name) definition)
194 name))
196 ;;;; CASE, TYPECASE, and friends
198 (eval-when (#-sb-xc :compile-toplevel :load-toplevel :execute)
200 ;;; Make this a full warning during SBCL build.
201 (define-condition duplicate-case-key-warning (#-sb-xc-host style-warning #+sb-xc-host warning)
202 ((key :initarg :key
203 :reader case-warning-key)
204 (case-kind :initarg :case-kind
205 :reader case-warning-case-kind)
206 (occurrences :initarg :occurrences
207 :type list
208 :reader duplicate-case-key-warning-occurrences))
209 (:report
210 (lambda (condition stream)
211 (format stream
212 "Duplicate key ~S in ~S form, ~
213 occurring in~{~#[~; and~]~{ the ~:R clause:~%~< ~S~:>~}~^,~}."
214 (case-warning-key condition)
215 (case-warning-case-kind condition)
216 (duplicate-case-key-warning-occurrences condition)))))
218 ;;; CASE-BODY returns code for all the standard "case" macros. NAME is
219 ;;; the macro name, and KEYFORM is the thing to case on. MULTI-P
220 ;;; indicates whether a branch may fire off a list of keys; otherwise,
221 ;;; a key that is a list is interpreted in some way as a single key.
222 ;;; When MULTI-P, TEST is applied to the value of KEYFORM and each key
223 ;;; for a given branch; otherwise, TEST is applied to the value of
224 ;;; KEYFORM and the entire first element, instead of each part, of the
225 ;;; case branch. When ERRORP, no OTHERWISE-CLAUSEs are recognized,
226 ;;; and an ERROR form is generated where control falls off the end
227 ;;; of the ordinary clauses. When PROCEEDP, it is an error to
228 ;;; omit ERRORP, and the ERROR form generated is executed within a
229 ;;; RESTART-CASE allowing KEYFORM to be set and retested.
230 (defun case-body (name keyform cases multi-p test errorp proceedp needcasesp)
231 (unless (or cases (not needcasesp))
232 (warn "no clauses in ~S" name))
233 (let ((keyform-value (gensym))
234 (clauses ())
235 (keys ())
236 (keys-seen (make-hash-table :test #'eql)))
237 (do* ((cases cases (cdr cases))
238 (case (car cases) (car cases))
239 (case-position 1 (1+ case-position)))
240 ((null cases) nil)
241 (flet ((check-clause (case-keys)
242 (loop for k in case-keys
243 for existing = (gethash k keys-seen)
244 do (when existing
245 (let ((sb!c::*current-path*
246 (when (boundp 'sb!c::*source-paths*)
247 (or (sb!c::get-source-path case)
248 (and (boundp 'sb!c::*current-path*)
249 sb!c::*current-path*)))))
250 (warn 'duplicate-case-key-warning
251 :key k
252 :case-kind name
253 :occurrences `(,existing (,case-position (,case)))))))
254 (let ((record (list case-position (list case))))
255 (dolist (k case-keys)
256 (setf (gethash k keys-seen) record)))))
257 (unless (list-of-length-at-least-p case 1)
258 (error "~S -- bad clause in ~S" case name))
259 (destructuring-bind (keyoid &rest forms) case
260 (cond (;; an OTHERWISE-CLAUSE
262 ;; By the way... The old code here tried gave
263 ;; STYLE-WARNINGs for normal-clauses which looked as
264 ;; though they might've been intended to be
265 ;; otherwise-clauses. As Tony Martinez reported on
266 ;; sbcl-devel 2004-11-09 there are sometimes good
267 ;; reasons to write clauses like that; and as I noticed
268 ;; when trying to understand the old code so I could
269 ;; understand his patch, trying to guess which clauses
270 ;; don't have good reasons is fundamentally kind of a
271 ;; mess. SBCL does issue style warnings rather
272 ;; enthusiastically, and I have often justified that by
273 ;; arguing that we're doing that to detect issues which
274 ;; are tedious for programmers to detect for by
275 ;; proofreading (like small typoes in long symbol
276 ;; names, or duplicate function definitions in large
277 ;; files). This doesn't seem to be an issue like that,
278 ;; and I can't think of a comparably good justification
279 ;; for giving STYLE-WARNINGs for legal code here, so
280 ;; now we just hope the programmer knows what he's
281 ;; doing. -- WHN 2004-11-20
282 (and (not errorp) ; possible only in CASE or TYPECASE,
283 ; not in [EC]CASE or [EC]TYPECASE
284 (memq keyoid '(t otherwise))
285 (null (cdr cases)))
286 (push `(t nil ,@forms) clauses))
287 ((and multi-p (listp keyoid))
288 (setf keys (nconc (reverse keyoid) keys))
289 (check-clause keyoid)
290 (push `((or ,@(mapcar (lambda (key)
291 `(,test ,keyform-value ',key))
292 keyoid))
294 ,@forms)
295 clauses))
297 (when (and (eq name 'case)
298 (cdr cases)
299 (memq keyoid '(t otherwise)))
300 (error 'simple-reference-error
301 :format-control
302 "~@<~IBad ~S clause:~:@_ ~S~:@_~S allowed as the key ~
303 designator only in the final otherwise-clause, not in a ~
304 normal-clause. Use (~S) instead, or move the clause the ~
305 correct position.~:@>"
306 :format-arguments (list 'case case keyoid keyoid)
307 :references `((:ansi-cl :macro case))))
308 (push keyoid keys)
309 (check-clause (list keyoid))
310 (push `((,test ,keyform-value ',keyoid)
312 ,@forms)
313 clauses))))))
314 (setq keys
315 (nreverse (mapcon (lambda (tail)
316 (unless (member (car tail) (cdr tail))
317 (list (car tail))))
318 keys)))
319 (case-body-aux name keyform keyform-value clauses keys errorp proceedp
320 `(,(if multi-p 'member 'or) ,@keys))))
322 ;;; CASE-BODY-AUX provides the expansion once CASE-BODY has groveled
323 ;;; all the cases. Note: it is not necessary that the resulting code
324 ;;; signal case-failure conditions, but that's what KMP's prototype
325 ;;; code did. We call CASE-BODY-ERROR, because of how closures are
326 ;;; compiled. RESTART-CASE has forms with closures that the compiler
327 ;;; causes to be generated at the top of any function using the case
328 ;;; macros, regardless of whether they are needed.
330 ;;; The CASE-BODY-ERROR function is defined later, when the
331 ;;; RESTART-CASE macro has been defined.
332 (defun case-body-aux (name keyform keyform-value clauses keys
333 errorp proceedp expected-type)
334 (if proceedp
335 (let ((block (gensym))
336 (again (gensym)))
337 `(let ((,keyform-value ,keyform))
338 (block ,block
339 (tagbody
340 ,again
341 (return-from
342 ,block
343 (cond ,@(nreverse clauses)
345 (setf ,keyform-value
346 (setf ,keyform
347 (case-body-error
348 ',name ',keyform ,keyform-value
349 ',expected-type ',keys)))
350 (go ,again))))))))
351 `(let ((,keyform-value ,keyform))
352 (declare (ignorable ,keyform-value)) ; e.g. (CASE KEY (T))
353 (cond
354 ,@(nreverse clauses)
355 ,@(when errorp
356 `((t (,(ecase name
357 (etypecase 'etypecase-failure)
358 (ecase 'ecase-failure))
359 ,keyform-value ',keys))))))))
360 ) ; EVAL-WHEN
362 (sb!xc:defmacro case (keyform &body cases)
363 #!+sb-doc
364 "CASE Keyform {({(Key*) | Key} Form*)}*
365 Evaluates the Forms in the first clause with a Key EQL to the value of
366 Keyform. If a singleton key is T then the clause is a default clause."
367 (case-body 'case keyform cases t 'eql nil nil nil))
369 (sb!xc:defmacro ccase (keyform &body cases)
370 #!+sb-doc
371 "CCASE Keyform {({(Key*) | Key} Form*)}*
372 Evaluates the Forms in the first clause with a Key EQL to the value of
373 Keyform. If none of the keys matches then a correctable error is
374 signalled."
375 (case-body 'ccase keyform cases t 'eql t t t))
377 (sb!xc:defmacro ecase (keyform &body cases)
378 #!+sb-doc
379 "ECASE Keyform {({(Key*) | Key} Form*)}*
380 Evaluates the Forms in the first clause with a Key EQL to the value of
381 Keyform. If none of the keys matches then an error is signalled."
382 (case-body 'ecase keyform cases t 'eql t nil t))
384 (sb!xc:defmacro typecase (keyform &body cases)
385 #!+sb-doc
386 "TYPECASE Keyform {(Type Form*)}*
387 Evaluates the Forms in the first clause for which TYPEP of Keyform and Type
388 is true."
389 (case-body 'typecase keyform cases nil 'typep nil nil nil))
391 (sb!xc:defmacro ctypecase (keyform &body cases)
392 #!+sb-doc
393 "CTYPECASE Keyform {(Type Form*)}*
394 Evaluates the Forms in the first clause for which TYPEP of Keyform and Type
395 is true. If no form is satisfied then a correctable error is signalled."
396 (case-body 'ctypecase keyform cases nil 'typep t t t))
398 (sb!xc:defmacro etypecase (keyform &body cases)
399 #!+sb-doc
400 "ETYPECASE Keyform {(Type Form*)}*
401 Evaluates the Forms in the first clause for which TYPEP of Keyform and Type
402 is true. If no form is satisfied then an error is signalled."
403 (case-body 'etypecase keyform cases nil 'typep t nil t))
405 ;;; Compile a version of BODY for all TYPES, and dispatch to the
406 ;;; correct one based on the value of VAR. This was originally used
407 ;;; only for strings, hence the name. Renaming it to something more
408 ;;; generic might not be a bad idea.
409 (sb!xc:defmacro string-dispatch ((&rest types) var &body body)
410 (let ((fun (sb!xc:gensym "STRING-DISPATCH-FUN")))
411 `(flet ((,fun (,var)
412 ,@body))
413 (declare (inline ,fun))
414 (etypecase ,var
415 ,@(loop for type in types
416 ;; TRULY-THE allows transforms to take advantage of the type
417 ;; information without need for constraint propagation.
418 collect `(,type (,fun (truly-the ,type ,var))))))))
420 ;;;; WITH-FOO i/o-related macros
422 (sb!xc:defmacro with-open-stream ((var stream) &body forms-decls)
423 (multiple-value-bind (forms decls) (parse-body forms-decls nil)
424 (let ((abortp (gensym)))
425 `(let ((,var ,stream)
426 (,abortp t))
427 ,@decls
428 (unwind-protect
429 (multiple-value-prog1
430 (progn ,@forms)
431 (setq ,abortp nil))
432 (when ,var
433 (close ,var :abort ,abortp)))))))
435 (sb!xc:defmacro with-open-file ((stream filespec &rest options)
436 &body body)
437 `(with-open-stream (,stream (open ,filespec ,@options))
438 ,@body))
440 (sb!xc:defmacro with-input-from-string ((var string &key index start end)
441 &body forms-decls)
442 (multiple-value-bind (forms decls) (parse-body forms-decls nil)
443 `(let ((,var
444 ;; Should (WITH-INPUT-FROM-STRING (stream str :start nil :end 5))
445 ;; pass the explicit NIL, and thus get an error? It's logical
446 ;; because an explicit NIL does not mean "default" in any other
447 ;; string operation. So why does it here?
448 ,(if (null end)
449 `(make-string-input-stream ,string ,@(if start (list start)))
450 `(make-string-input-stream ,string ,(or start 0) ,end))))
451 ,@decls
452 (multiple-value-prog1
453 (unwind-protect
454 (progn ,@forms)
455 (close ,var))
456 ,@(when index
457 `((setf ,index (string-input-stream-current ,var))))))))
459 (sb!xc:defmacro with-output-to-string
460 ((var &optional string &key (element-type ''character))
461 &body forms-decls)
462 (multiple-value-bind (forms decls) (parse-body forms-decls nil)
463 (if string
464 (let ((element-type-var (gensym)))
465 `(let ((,var (make-fill-pointer-output-stream ,string))
466 ;; ELEMENT-TYPE isn't currently used for anything
467 ;; (see FILL-POINTER-OUTPUT-STREAM FIXME in stream.lisp),
468 ;; but it still has to be evaluated for side-effects.
469 (,element-type-var ,element-type))
470 (declare (ignore ,element-type-var))
471 ,@decls
472 (unwind-protect
473 (progn ,@forms)
474 (close ,var))))
475 `(let ((,var (make-string-output-stream
476 ;; CHARACTER is the default element-type of
477 ;; string-ouput-stream, save a few bytes when passing it
478 ,@(and (not (equal element-type ''character))
479 `(:element-type ,element-type)))))
480 ,@decls
481 (unwind-protect
482 (progn ,@forms)
483 (close ,var))
484 (get-output-stream-string ,var)))))
486 ;;;; miscellaneous macros
488 (sb!xc:defmacro nth-value (n form &environment env)
489 #!+sb-doc
490 "Evaluate FORM and return the Nth value (zero based)
491 without consing a temporary list of values."
492 ;; FIXME: The above is true, if slightly misleading. The
493 ;; MULTIPLE-VALUE-BIND idiom [ as opposed to MULTIPLE-VALUE-CALL
494 ;; (LAMBDA (&REST VALUES) (NTH N VALUES)) ] does indeed not cons at
495 ;; runtime. However, for large N (say N = 200), COMPILE on such a
496 ;; form will take longer than can be described as adequate, as the
497 ;; optional dispatch mechanism for the M-V-B gets increasingly
498 ;; hairy.
499 (let ((val (and (sb!xc:constantp n env) (constant-form-value n env))))
500 (if (and (integerp val) (<= 0 val 10)) ; Arbitrary limit.
501 (let ((dummy-list (make-gensym-list val))
502 (keeper (sb!xc:gensym "KEEPER")))
503 `(multiple-value-bind (,@dummy-list ,keeper) ,form
504 (declare (ignore ,@dummy-list))
505 ,keeper))
506 ;; &MORE conversion handily deals with non-constant N,
507 ;; avoiding the unstylish practice of inserting FORM into the
508 ;; expansion more than once to pick off a few small values.
509 ;; This is not as good as above, because it uses TAIL-CALL-VARIABLE.
510 `(multiple-value-call
511 (lambda (n &rest list) (nth (truly-the index n) list))
512 (the index ,n) ,form))))
514 (sb!xc:defmacro declaim (&rest specs)
515 #!+sb-doc
516 "DECLAIM Declaration*
517 Do a declaration or declarations for the global environment."
518 `(eval-when (:compile-toplevel :load-toplevel :execute)
519 ,@(mapcar (lambda (spec)
520 `(sb!c::%proclaim ',spec (sb!c:source-location)))
521 specs)))
523 ;; Avoid unknown return values in emitted code for PRINT-UNREADABLE-OBJECT
524 (declaim (ftype (sfunction (t t t t &optional t) null)
525 %print-unreadable-object))
526 (sb!xc:defmacro print-unreadable-object ((object stream &key type identity)
527 &body body)
528 #!+sb-doc
529 "Output OBJECT to STREAM with \"#<\" prefix, \">\" suffix, optionally
530 with object-type prefix and object-identity suffix, and executing the
531 code in BODY to provide possible further output."
532 ;; Note: possibly out-of-order keyword argument evaluation.
533 (let ((call `(%print-unreadable-object ,object ,stream ,type ,identity)))
534 (if body
535 (let ((fun (make-symbol "THUNK")))
536 `(dx-flet ((,fun () ,@body)) (,@call #',fun)))
537 call)))
539 (sb!xc:defmacro ignore-errors (&rest forms)
540 #!+sb-doc
541 "Execute FORMS handling ERROR conditions, returning the result of the last
542 form, or (VALUES NIL the-ERROR-that-was-caught) if an ERROR was handled."
543 `(handler-case (progn ,@forms)
544 (error (condition) (values nil condition))))
546 ;; A macroexpander helper. Not sure where else to put this.
547 (defun funarg-bind/call-forms (funarg arg-forms)
548 (if (typep funarg
549 '(or (cons (eql function) (cons (satisfies legal-fun-name-p) null))
550 (cons (eql quote) (cons symbol null))
551 (cons (eql lambda))))
552 (values nil `(funcall ,funarg . ,arg-forms))
553 (let ((fn-sym (sb!xc:gensym))) ; for ONCE-ONLY-ish purposes
554 (values `((,fn-sym (%coerce-callable-to-fun ,funarg)))
555 `(sb!c::%funcall ,fn-sym . ,arg-forms)))))