This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: new newbie problem: file dependencies


Sorry, 

for my question being incomprehensible!

Per Bothner writes:
 > Dr. M. Luedde wrote:
 > > how can I load and run mutually dependent files?
 > 
 > Why can't you just load them?
 > 
 > > E.g., I have Scheme files A and B where file A starts as
`loader:load
 > > B' and file B starts as `loader:load A'.
 > 
 > Ah, you mean you want to have another application load either A or B
 > and have that automatically load the other.  That is not quite
 > same.

Right. The problem is, file A might provide part of some desired
functionality, but for implementation purposes builds upon
functionality provided in file B. Conversely, file B for the same
reason might depend on file A (think of `#include' directives in C++).

The user of file A does not want to know about file B.  They just want
to load file A.
 
 > > The `loader:load' procedure first marks a file as locked, then
loads
 > > it, then unlocks it, then marks it as loaded, in order to prevent
 > > circular loading.
 > 
 > The (require ...) syntax provides similar functionality.

`require' does not seem to be in R5RS, so I implemented some quite
simple-minded procedures around a "class" or package that I call
`loader'.

 > > This works fine on Chez Scheme, MzScheme, MIT Scheme, but not on
kawa
 > > 1.6.98, which complains about undefined symbols.

The reason for this behavior seems to be clear for a compiler that
works on a per-file basis, like in C++, and cannot resolve mutual
dependencies:

Loading A means locking A, then loading B.  Loading B means locking B,
then trying to load A.  Since A is locked already, B is read in. When
compiling on-the-fly, as probably happens in kawa, the symbols from A
are now missing.

 > Can you point me to documentation for loader:load?  I don't see it
 > in the MzScheme or Chez Scheme manuals.

See above.

Is there an easy and elegant way out? 

Thanks for your patience, Mirko. 
-- 
Dr. M. Luedde <Mirko.Luedde@Computer.Org>

__________________________________________________________________

Gesendet von Yahoo! Mail - http://mail.yahoo.de
Sie brauchen mehr Speicher für Ihre E-Mails? - http://premiummail.yahoo.de


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