You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Неточка Незванова edited this page Oct 22, 2021
·
2 revisions
What sbcl does to:
(defun f (x &optional (y (complex-thing)))
(+ x y))
=>
COMPONENT: DEFUN F
FUNCTION: f-XEP (arg-count x y)
if arg-count = 1
tail-call f-optional-processor (x)
if arg-count = 2
tail-call fixed-arg-f (x y)
else arg-count-error ()
FUNCTION: f-optional-processor (x)
tail-call fixed-arg-f (x (call complex-thing))
FUNCTION: fixed-arg-f (x y)
(+ x y)
Then whenever you call f externally like (f 4) from the REPL it is actually f-XEP that you are calling.
If f was compiled in the same component as another function g which calls f like (f 3 4),
then g can simply use knowledge of F's arglist to pick the fixed-arg-f "entry point" function without going through f-XEP.