其他答案涵蓋了這個問題。
但是,從實踐層面,如果你正在使用的Common Lisp和煤泥,並希望能夠編譯代碼到退出Emacs正在運行的程序,你需要告訴斯旺克從您的循環內進行更新。
將以下內容添加到您的代碼中,然後在循環中添加(更新swank)。
(defmacro continuable (&body body)
`(restart-case
(progn ,@body)
(continue() :report "Just Continue")))
(defun update-swank()
"Called from within the main loop, this keep the lisp repl working"
(continuable
(let ((connection (or swank::*emacs-connection*
(swank::default-connection))))
(when connection
(swank::handle-requests connection t)))))
這是使用你可以用你的編輯器重新編譯直播as in this video(對不起,我堵自己的VID)事實的一種方式。
另一種方式(再次與斯萊姆)是告訴它使用不同的線程進行通信。但我更喜歡前一種方法,因爲在跨線程使用時,opengl非常不穩定。
[詳細信息] 上述代碼中的可持續宏捕獲任何錯誤,並讓您選擇忽略它並繼續。我發現這真的很有幫助,我經常在repl中犯錯誤,我不想從錯誤中「中止」,因爲這會中止我的主循環。
我不知道具體實施的 - 但看的人,當他們評價不編譯。因此,這將排除SBCL的實例(可能還有很多現代的Common Lisp實現)。 – verdammelt
基本上是一個副本:http://stackoverflow.com/questions/16914779/levels-of-homoiconicity –
@verdammelt:請參閱http://www.sbcl.org/manual/#Interpreter –