From: Barry Margolin
Subject: Re: autoload lisp packages?
Date: 
Message-ID: <5vcqil$qoe@tools.bbnplanet.com>
In article <·············@wintermute.eagle>,
SDS  <···········@cctrading.com> wrote:
>I am somewhat confused by the Lisp packaging system.
>I use CLISP and I downloaded metering.lsp (for profiling).
>I want to profile my code only sometimes, and I do not want to load
>metering every single time.
>But I can neither eval nor compile a function containg
>
>	(cond (whatever
>		(load "metering.fas")
>		(mon:monitor-form (form)))
>	      (t (form)))
>
>if metering is not loaded, I get an error that there is no such package
>as mon. Of course there is no such package *yet*, but I am not calling
>anything from that package *yet*, right?

The problem is that the package system is implemented at READ time, not at
CALL time.

The usual way to work around this is with something like this:

(cond (whatever
        (load "metering.fas")
        (funcall (find-symbol "MONITOR-FORM" "MON") (form)))
      (t (form)))

In your case, though, I don't think this will work.  I suspect
MON:MONITOR-FORM is a macro, not a function.  The problem here is that
macros are expanded at compile time, but the LOAD won't happen until run
time.  Since you need the macro at compile time, there's no way to
conditionalize it in the runtime code.

-- 
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.