Subject: Re: organizing lisp code
From: (Rob Warnock)
Date: Sun, 04 Jun 2006 19:16:33 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
<> wrote:
| Mikalai wrote:
| > Do not forget that you may use REQUIRE, not just LOAD. In file that you
| > require, put a provide option. Required file will be loaded only once!
| That is another thing I have learnt now :-) I've seen the same in
| several emacs lisp packages but never in CL.  However, CLtL2 appears
| to favour usage of DEFPACKAGE over REQUIRE and PROVIDE:

But remember that CLtL2 is *NOT* normative, nor was it ever approved
by ANSI, and in fact it occasionally differs in significant ways from
what ended up in the actual standard.

| Hyperspec also says:
|  | The functions provide and require are deprecated. |

But note that the CLHS *also* says:

    1.8 Deprecated Language Features
    Deprecated language features are not expected to appear in
    future Common Lisp tandards, but are required to be implemented
    for conformance with this standard; see Section
    (Required Language Features).

Common Lisp has *LOTS* of deprecated language features that people
depend on working properly in any decent implementation.  ;-}  ;-}

| Is it recommended to use REQUIRE and PROVIDE?

Recommended by whom? In what circumstances? They're required (pardon
the pun) to be there, so you can depend on them being there, but their
behavior is under-specified and/or implementation-dependent [which is
the main reason they were deprecated], so you might have to wrap some
feature tests around them for portability across CL implementations.

| Are they used often?

I can't speak for others, but I use them a lot in interactive (REPL)
sessions to suck in locally-written small libs. But for starting up
large and/or long-running applications, I tend to use a mixture of
REQUIRE and ASDF, with more of the latter the bigger the app is.

Note that SBCL has blurred the line further by extending REQUIRE
there is a "foo.asd" visible via the ASDF:*CENTRAL-REGISTRY*.

In short, REQURE/PROVIDE are perfectly fine to use, if their
limitations don't get in the way for you. If I were writing
libraries intended for use by others, I'd supply an ASDF wrapper.


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607