3 Jan 2010 21:23
Re: The point of 'provide'
Peter Bex <Peter.Bex <at> xs4all.nl>
2010-01-03 20:23:13 GMT
2010-01-03 20:23:13 GMT
On Sun, Jan 03, 2010 at 02:18:09PM -0500, John Cowan wrote: Hi John, Thanks for your very detailed answer! > That is because 'use' does a 'require' (which calls 'provided?', and > if it returns #f, calls 'load'). If you define the module in this way, > you want to use 'import' rather than 'use'. My goal here is to load a file regardless of whether it was loaded by some bootstrap code or installed as an extension. Is there a way to do this programmatically? > There's a bug here, as shown by the traceback: > > (##core#begin (##sys#require (quote foo)) (import foo)) > > This is an attempt to require *and then* import, but it cannot work, > because import is a macro and does its work at macroexpansion time, > whereas ##sys#require is a procedure and does its work at runtime. Ah, it finally makes sense why this is going wrong. I was put on the wrong track by the error I got. Cheers, Peter -- -- http://sjamaan.ath.cx -- "The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." -- Donald Knuth
RSS Feed