chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] The point of 'provide'


From: Peter Bex
Subject: Re: [Chicken-users] The point of 'provide'
Date: Sun, 3 Jan 2010 21:23:13 +0100
User-agent: Mutt/1.4.2.3i

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]