This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: require vs use-modules


>>>>> "Chris" == Chris Bitmead <chrisb@ans.com.au> writes:

Chris> What if any is the relationship between slib's (require ..) and guile's
Chris> (use-module ...)

There is (AFAIK) no relation.

Require is an older convention of doing conditional loading. Slib and
emacs uses it. It is much simpler than a module system, it only allows
a file to register its presence. There are no associated scoping and
import/export stuff.

Chris> Are they interchangable? 

Not really. `Require' expects the file in question to contain a
corresponding `provide' whereas `use-modules' expects the file to
contain a corresponding `define-module'.
 
Chris> Should I favour one over the other? 

It probably depends. If you want to use guile modules, it would be
rather silly (IMHO) not to use `use-modules'. If you do not, you
should definitely use `require'.

Chris> Are they meant for different purposes?

No, I think you could say they serve the same purpose of loading files
only when they have not already been loaded, but they have different
histories/origins. The `require' scheme is much simpler in that it uses a
flat list of "features" and thus really has nothing to do with module
systems as such.


---------------------------+--------------------------------------------------
Christian Lynbech          | Telebit Communications A/S                       
Fax:   +45 8628 8186       | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28  | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)