Lisp HUG Maillist Archive

Hmm...

What is the difference between these five ways of calling a function?

(find-package "APKG")

(funcall 'find-package "APKG")

(funcall #'find-package "APKG")

(apply 'find-package "APKG" nil)

(apply #'find-package "APKG" nil)

;; ---------------------------------------------

Answer: In theory, no difference at all. They all show the same disassembly of compiled forms. BUT!!!

But those using (FUNCTION find-package) instead of (QUOTE find-package), i.e., the third and the fifth, skip any advices placed on the function and go straight to the original definition.

So it appears that if you want to be open to advices on functions, we should always forego the (FUNCTION ...) protocol.

BTW:  (funcall (symbol-function 'find-package) "APKG") also fails the advices.

So, how can it be that they all show the same disassembly?

Dr. David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ  85750

email: dbm@refined-audiometrics.com
phone: 1.520.390.3995
web: http://refined-audiometrics.com



Updated at: 2020-12-10 08:38 UTC