Reputation: 10920
I am new to Common Lisp. This is how I develop programs in other languages, and also how I now develop programs in Common Lisp:
sbcl --script myprog.lisp
)This is the conventional write-compile-run development cycle for most programming languages. However, in the lisp world, I hear things like "interactive development" and "image-based development", and I feel that I am missing out on an important feature of Common Lisp. How do I do "image-based development" instead of "write-compile-run development"?
Can someone provide a step-by-step example of "image-based development" similar to how I described "write-compile-run development" above?
(Note: I am using SBCL)
Upvotes: 11
Views: 2055
Reputation: 139261
In typical Common Lisp implementations the runtime, the compiler, parts of the development environment and the program you are developing reside in the same program and share the same object space. The compiler is always available while you develop the program and the program can be incrementally developed. The development tools have access to all objects and can inspect their state. One can also undefine/remove, replace, enhance functionality from the running program.
Thus:
Fixes to program bugs can also shipped to the user as compiled Lisp files, which gets loaded into the delivered program and update the code then.
Upvotes: 10
Reputation: 51501
Let's say that you are using SBCL with Emacs and SLIME (e. g. through Portacle).
M-x slime
) — this starts a “plain” Lisp process in the background and connects the editor functions provided by slime to it; then gives you a REPL that is also connected into this process (image)foo.lisp
)C-c C-k
to compile the file and load it into the running Lisp processThis is just very basic usage. Further things to do/learn
C-c C-c
)Note that you never need to unload your program, you just modify it, even when downloading and loading new libraries. This makes the feedback cycle instantaneous in most cases. You also never need to switch away from the IDE (Emacs).
Upvotes: 9