[Chicken-users] The point of 'provide'

2010-01-03 Thread Peter Bex
Hi all, I had a problem today which I already had before: when you define a module, you cannot (use ) it unless you also (provide ) the extension: #;1> (module foo (bar) (import chicken scheme) (define (bar) (print "bar"))) ; loading /usr/pkg/lib/chicken/4/chicken.import.so ... ; loading /usr/pkg

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

2010-01-03 Thread John Cowan
Peter Bex scripsit: > I had a problem today which I already had before: when you define a > module, you cannot (use ) it unless you also (provide ) the extension: > > #;1> (module foo (bar) (import chicken scheme) (define (bar) (print "bar"))) > ; loading /usr/pkg/lib/chicken/4/chicken.import.so

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

2010-01-03 Thread John Cowan
Scripsi: > 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 proced

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

2010-01-03 Thread Rob Roland
I'll admit to being entirely new to this before I reply, but it looks like ##core#require-extension (compiler.scm) is calling ##sys#do-the-right-thing (eval.scm). ##sys#do-the-right-thing is calling import. Line 1233: `((import ,id));XXX make hygienic I believe the attached patch m

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

2010-01-03 Thread Peter Bex
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'

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

2010-01-03 Thread John Cowan
Rob Roland scripsit: > I'll admit to being entirely new to this before I reply, but it looks like > ##core#require-extension (compiler.scm) is calling ##sys#do-the-right-thing > (eval.scm). > > ##sys#do-the-right-thing is calling import. Line 1233: > > `((import ,id));XXX make hygi

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

2010-01-03 Thread John Cowan
Peter Bex scripsit: > 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? Require does the job as far as mere loading is concerned, but as for programmatic importing, you must us

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

2010-01-05 Thread Peter Bex
On Sun, Jan 03, 2010 at 10:13:05PM -0500, John Cowan wrote: > Peter Bex scripsit: > > > 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? > > Require does the job as far

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

2010-01-05 Thread Mario Domenech Goulart
On Tue, 5 Jan 2010 14:59:21 +0100 Peter Bex wrote: > On Sun, Jan 03, 2010 at 10:13:05PM -0500, John Cowan wrote: >> Peter Bex scripsit: >> >> > 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 t

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

2010-01-05 Thread John Cowan
Peter Bex scripsit: > That's interesting, but what I really meant was: "is there a way to add > directories to where USE looks for extensions?" USE looks where REQUIRE looks, so try setting the environment variable CHICKEN_REPOSITORY or the parameter repository-path. -- John Cowanco...@ccil

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

2010-01-06 Thread Peter Bex
On Tue, Jan 05, 2010 at 05:43:40PM -0500, Mario Domenech Goulart wrote: > Maybe #135 (http://www.irp.oist.jp/trac/chicken/ticket/135) is somehow > related to what you want. I suppose it would be, if I got it to work to that stage ;) Cheers, Peter -- http://sjamaan.ath.cx -- "The process of prepa

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

2010-01-06 Thread Peter Bex
On Tue, Jan 05, 2010 at 07:49:42PM -0500, John Cowan wrote: > Peter Bex scripsit: > > > That's interesting, but what I really meant was: "is there a way to add > > directories to where USE looks for extensions?" > > USE looks where REQUIRE looks, so try setting the environment variable > CHICKEN_