Mon 23 Jul 2007

Nokia 770

$150… worth it?

Posted at 2007-07-23 20:35:54 by RichardLink to Nokia 770
Comments, trackbacks.

ASDF stubs redux

I got distracted. A mere 3 months later, I've finally packaged up asdf-cat. The name change was suggested by Zhivago and lemonodor on #lisp, because “stub” misleadingly implies missing functionality. “cat”, of course, is short for “concatenation”.

You can do this:
$ mlisp
;; ACL loads...
;; Current reader case mode: :case-sensitive-lower
cl-user(1): (load "/usr/local/fasls/asdf-cat.fasl")
; Fast loading /usr/local/fasls/asdf-cat.fasl
t
cl-user(2): (asdf-cat:build-fasl 'cl-who)
; Loading /Users/rnewman/asdf/cl-who.asd
; Fast loading /Users/rnewman/acl80/code/streamc.001
;;; Installing foreign patch, version 1
; Fast loading from bundle code/efft-utf8-base.fasl.
; Fast loading from bundle code/efft-void.fasl.
; Fast loading from bundle code/efft-latin1-base.fasl.
;; Building FASL for cl-who.
;; System cl-who: appending /Users/.../packages.fasl
;; System cl-who: appending /Users/.../who.fasl
concat-fasls done with system #<system "cl-who" @ #x10579c62>
nil
Now you have /usr/local/fasls/cl-who.fasl, which you can load in one piece. This is the concatenation of all of the files that ASDF would load, in order. (By putting the output path in your require search path, you can even avoid ASDF or load.) Think of this as half-way between normal ASDF and building a Lisp image (e.g., save-lisp-and-die or writing an Allegro dxl).

If you decide that you still want to use ASDF for loading your systems, you can also write out /usr/local/fasls/cl-who.asd, which is a very minimal ASDF system that just loads this big .fasl. It's generated by processing the original system definition with build-proxy-definition:
cl-user(3): (asdf-cat:build-proxy-definition 'cl-who)
;; Generating stub ASDF in /usr/local/fasls/cl-who.asd
nil
cl-user(4): (exit)
; Exiting
and it looks like this:
(in-package #:cl-user) 
(defpackage #:cl-who.system (:use #:cl #:asdf))
(in-package #:cl-who.system)
(defsystem #:cl-who
:components ((:file "cl-who"))
:depends-on nil
:weakly-depends-on nil
:in-order-to nil)
ASDF dependencies will work as usual, of course.

Voila! No compilation, no messing around with multiple files. Just one thing to load, and three ways to load it (require, load, and the proxy ASDF system). The proxy system generator will probably break for unconventional systems, of course — those with test forms, or source files, or non-code resources — but for the majority it will solve some of your deployment headaches.

If you feel like more work in this area you could walk the dependencies and stub them out, too.

I've only tested the code on Allegro Common Lisp 8.0 on Mac OS X 10.4.10 (Intel). It should work on other architectures and Lisps; reports of success would be most welcome.

Download an archive of the code.

Posted at 2007-07-23 19:07:14 by RichardLink to ASDF stubs redux
Comments, trackbacks.

Google
Web holygoat.co.uk
  • richard is: