[gambit-list] multiple definitions due to include/load

Thomas Hafner thomas at hafner.NL.EU.ORG
Sun Feb 5 17:09:14 EST 2006


What about if definitions are included/loaded multiple times due to
(use-)dependencies of Gambit-C 4 source files?

E.g. if lib1.scm uses lib2.scm, and bar.scm uses lib1.scm *and*
lib2.scm, then lib2.scm is used twice by bar.scm: directly and
indirectly (i.e. via lib1.scm). Of course lib1.scm should not rely on
such applications, e.g. there might be foo.scm which just uses
lib1.scm, but *not* lib2.scm.

C programmers like to avoid multiple includes by protecting headers by
that well known pattern:

/* this is file lib2.h */
#ifndef _LIB2_
#define _LIB2_
...
#endif

Gauche Scheme has something which sounds related (quoted from the
manual):

| -- Function: provide feature
|     Adds FEATURE to the system's provided feature list, so that the
|     subsequent `require' won't load the same file again.

LaTeX does similiar: compare \providecommand and \newcommand.

Is there a simple way for Gambit? Or doesn't it matter at all? (Why
not?)

Regards
  Thomas



More information about the Gambit-list mailing list