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 Bitmead <chrisb@ans.com.au> writes:

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

'require' is a slib-ism.  'use-module' is a guile-ism.  'require'
brings in the named slib package.  'use-module' brings in the named
guile module.  slib packages are named by symbols.  guile modules are
named by lists of symbols that correspond to file system locations.  I
could go into more detail, but I think you get the idea.

If you haven't gotten the chance, take a walk through the slib manual
some time.  There is lots of good stuff in there, and it's all pretty
portable.

> Should I favour one over the other?

I write code that leverages slib.  Usually, in any non-trivial program
that I write with guile, I tend to use both.  I guess you must be
referring to writing new code, though.  In that case, I would
recommend using the guile module system in preference to the slib
require mechanism, because it's more configurable in terms of where
the files can be installed, and provides proper namespace protection
(not that I'm saying guile's module system is perfect, it's just
better than require).

> Are they interchangable?

No, see above.

> Are they meant for different purposes?

Yes, see above.

-russ

--
When I was a boy I was told that anybody could become President.  Now
I'm beginning to believe it.
             --Clarence Darrow