Generic Lisp: Compilation and Evaluation

In Emacs + Slime with sbcl, as soon as I define a function (or more) in a file, I have two options:

  • Rating . with CMx eval-defun
  • Compilation . with compiler Cc Mk file

The second also creates the .fasl file.

What are the differences between the two?

What happens under the hood when compiling a definition / file?

What are the advantages and disadvantages of each?

+5
source share
4 answers

, eval [1], ( ) CL . CL : . , . CL , . , eval . (, SBCL , , sb-ext:*evaluator-mode* :interpret, CLISP ).

compile-file [2], - . .

, CL 3 : , . , , ( ) CL eval-when [3].

, C-M-x eval-defun eval . , , . C-c M-k compile-file compile-file , .

+7

, .

, , , . , . , -, . . , , . 2 :

  • , , , , .
  • , , .

, , . , , , , ( ), .

, . (, Common Lisp), . "" - . - . , . () , .

, 2 :

  • , , . , , . .
  • , , , , . .

: , , , 2- . , , , , , .

, SBCL REPL ( ) . , .

+3

, , sbcl, , , Common Lisp.

, . , , - ; , , .

, - , .

, , eval-defun , , .

+2

, .

, - , SLIME Emacs, C-c C-c, ( M-x slime-compile-defun). ( ) , +, . , Flymake ( , , ).

, , . , , , . , -, , () - , , , .

Eval'ing defun - - SWANK, . , Lisp - , , SLIME .

+1

All Articles