Dear Lisp users,
I am a newbie to Lisp.
My project encounters a problem that different compiler of Lisp will
need to recompile all the lisp files in order to run it. I have to
switch to and from various versions of Lisp in order to make sure
something works.
The way I am currently use is to search for all fasl files under the
project directory, and then delete all these fasl files before working
on the project using another distribution of Lisp e.g. Allergo to
SBCL.
I tried "compile-file", but there are nested multiple files that I
need to recompile, while the lisp file for loading the whole project
is just 1 single file.
I am wondering if there is a smarter way of doing this, rather than
search and delete fasl files manually.
Thanks!
- John
On 17 jul, 12:59, John Wong <·······@gmail.com> wrote:
> Dear Lisp users,
>
> I am a newbie to Lisp.
> My project encounters a problem that different compiler of Lisp will
> need to recompile all the lisp files in order to run it. I have to
> switch to and from various versions of Lisp in order to make sure
> something works.
> The way I am currently use is to search for all fasl files under the
> project directory, and then delete all these fasl files before working
> on the project using another distribution of Lisp e.g. Allergo to
> SBCL.
>
> I tried "compile-file", but there are nested multiple files that I
> need to recompile, while the lisp file for loading the whole project
> is just 1 single file.
> I am wondering if there is a smarter way of doing this, rather than
> search and delete fasl files manually.
>
> Thanks!
>
> - John
http://common-lisp.net/project/cl-containers/asdf-binary-locations/
John Wong <·······@gmail.com> writes:
> Dear Lisp users,
>
> I am a newbie to Lisp.
> My project encounters a problem that different compiler of Lisp will
> need to recompile all the lisp files in order to run it. I have to
> switch to and from various versions of Lisp in order to make sure
> something works.
> The way I am currently use is to search for all fasl files under the
> project directory, and then delete all these fasl files before working
> on the project using another distribution of Lisp e.g. Allergo to
> SBCL.
The common-lisp-controller package for Fedora & Debian/Ubuntu (and maybe
others) does this smartly: all FASLs are stored in
/var/cache/$IMPLEMENTATION/$UID/$PATH, so you can easily switch between
implementations.
I don't know if any has published the proper files to make Allegro use
it though.
--
Robert A. Uhl
Gates' Law: Every 18 months, the speed of software halves.
From: Alberto Riva
Subject: Re: "Recompile" VS delete all fasl and load + compile
Date:
Message-ID: <h3q9bo$tl1$1@usenet.osg.ufl.edu>
John Wong wrote:
> Dear Lisp users,
>
> I am a newbie to Lisp.
> My project encounters a problem that different compiler of Lisp will
> need to recompile all the lisp files in order to run it. I have to
> switch to and from various versions of Lisp in order to make sure
> something works.
> The way I am currently use is to search for all fasl files under the
> project directory, and then delete all these fasl files before working
> on the project using another distribution of Lisp e.g. Allergo to
> SBCL.
>
> I tried "compile-file", but there are nested multiple files that I
> need to recompile, while the lisp file for loading the whole project
> is just 1 single file.
> I am wondering if there is a smarter way of doing this, rather than
> search and delete fasl files manually.
Well, step 1 is to start using some kind of defsystem facility, unless
you're already doing it. That will automate the process of recompiling
files when necessary, and loading them in the right order. Defsystem is
not part of the standard, but most Lisp implementations offer their own
version defsystem tool, and there are also a few open source ones (e.g.
ASDF).
Once you have that, the general solution I'd use is to have separate
subdirectories for the compiled files for different lisps. Then you just
need to tell whatever defsystem tool you're using to store the compiled
files in a subdirectory whose name depends on the Lisp you're running
(use the symbols in *features* to detect it), and to load them from there.
Even if you don't want to go to the trouble of using a defsystem tool
(which I would recommend anyway) you can easily implement the basic
functionality yourself. Assuming that the global variable *files*
contains a list of the names of the files in your program, as strings,
you can do something like the following:
(defun source-pathname (f)
(format nil "/path/to/lisp/~a.lisp" f))
(defun fasl-pathname (f lisp-version)
(format nil "/path/to/lisp/~a/~a.fasl" lisp-version f))
(defun compile-all (lisp-version)
(dolist (f *files*)
(compile-file (source-pathname f)
:output (fasl-pathname f lisp-version)
:load-after-compile t)))
(defun load-all (lisp-version)
(dolist (f *files*)
(load (fasl-pathname f lisp-version))))
This is just a start (in particular you'd want to only recompile files
when needed instead of recompiling all of them every time), but it
should give you the general idea.
Alberto