difference between (defalias 'A (symbol-function 'B)) and (defalias 'A 'B)

前端 未结 2 1753
面向向阳花
面向向阳花 2021-02-04 00:08

I was reading subr.el and saw this code:

(defalias \'backward-delete-char \'delete-backward-char)
(defalias \'search-forward-regexp (symbol-function \'re-search-         


        
2条回答
  •  鱼传尺愫
    2021-02-04 00:39

    Well, it really is not the same thing... Here is a little game I just played:

    (defun a () (message "hello"))
    a
    (a)
    "hello"
    (defalias 'b (symbol-function 'a))
    (lambda nil (message "hello"))
    (defalias 'c 'a)
    a
    (b)
    "hello"
    (c)
    "hello"
    (defun a () (message "howdy"))
    a
    (a)
    "howdy"
    (b)
    "hello"
    (c)
    "howdy" ' c changed meaning, b did not...
    

提交回复
热议问题