Subject: Re: ASDF question
From: rpw3@rpw3.org (Rob Warnock)
Date: Mon, 18 Apr 2005 00:05:44 -0500
Newsgroups: comp.lang.lisp
Message-ID: <9pKdnbBz7vK13f7fRVn-gQ@speakeasy.net>
David Steuber  <david@david-steuber.com> wrote:
+---------------
| rif <rif@mit.edu> writes:
| > I have two ASDF systems, call them foo and bar.  foo depends on bar.
| > In general, I'll say something like
| >   (asdf:operate 'asdf:load-op :foo)
| > The system loads.  Now I make a change in bar.  I again load foo with
| > the above command.  bar recompiles, but foo does not recompile, even
| > though it depends on bar.  This is problematic, since foo uses macros
| > (for instance) which are defined in bar.
| > 
| > Is there something obvious that I'm missing?  What's the right way to
| > deal with this?
+---------------

I'm not sure about *between* ASDF systems, but within a single one I
find myself using something like this:

    (:file "foo" :depends-on (...whatever...)
		 :in-order-to ((compile-op (load-op "bar"))))

+---------------
| That's an interesting question.  When I'm developing, I edit and
| compile various definitions in my running image.  I do this by editing
| the source and using SLIME's C-c C-c (and on occasion C-c C-k).  So
| reloading the system definition is actually not something I ever do.
...
| So for me, ASDF is not about reloading or redefining anything.
+---------------

Interesting. When developing web-based apps, I do exactly the opposite!! ;-}
During periods of active development, I make the "foo.lhp" (Lisp-Handled
Pages) file look like this:

    ;;; Boilerplate for using ASDF from LHP page.
    (let ((system :foo)
	  (package :org.rpw3.foo)
	  (function :foo-main))
      (flet ((this-page (request)
	       ;; Ensure up-to-date each time.
	       (asdf:operate 'asdf:load-op system)
	       ;; Hack to avoid a package read error the very first time.
	       (funcall (intern (symbol-name function) package) request)))
	(lhp-set-page-function #'this-page)))

That way, ASDF verifies that everything's up to date and (re)compiled
on *every* web hit. That makes the development cycle *very* tight:
edit a bit, do a "save" in the editor, hit "Reload" in the browser,
and *boom*! Everything gets recompiled and the browser pops up the
new version of the page. [Or doesn't, and I look at the application
server's REPL and/or the Apache error log to figure out why.]

Yes, it costs a few extra cycles per page-hit, but IMHO it's well
worth it.  [...and you did notice that "during periods of active
development" qualifier, yes?]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607