>>>>> "WP" == Walter C Pelissero <walter@pelissero.org> writes:
WP> Martin Gasbichler writes:
>> >>>>> "WP" == Walter C Pelissero <walter@pelissero.org> writes:
WP> (define-structure program
WP> (export ...)
WP> (open scheme scsh)
WP> (begin
>>
>> >> (define (foo args)
>> >> ...)
>>
>> >> (load "source.scm")))
>>
WP> where source.scm makes use of foo.
>>
>> For me, the above code works fine...
WP> I'm sorry. The example was flawed. The load should be inside a
WP> define as in:
WP> (define (bar)
>> (load "source.scm"))
Hmm, I have:
[293] cat source.scm
(display (foo 32))
[294] cat test1.scm
(define-structure program
(export foo bar)
(open scheme scsh)
(begin
(define (foo arg)
(* arg 3))
(define (bar)
(load "source.scm"))))
[295] scsh
Scsh 0.5.3
> ,config ,load test1.scm
test1.scm .
> ,open program
Load structure program (y/n)? y
[program
..
]
> (bar)
source.scm 96
#f
>
So, I still don't see your problem...
>> But, why do you want to use LOAD at all? Why are you not putting
>> the code of source.scm in a separate module and open PROGRAM in it?
WP> source.scm is a generated source that collects a list of configuration
WP> statements. Anyway I'm not sure I understand what you mean.
WP> Is it something like this you are suggesting?
Yup.
WP> In, say, modules.scm:
>> (define-structure source
>> (open program)
>> (files source))
WP> and then from my, say, program.scm:
>> (define-structure program
>> (export foo ...)
>> (open scheme scsh source)
>> (begin ...))
WP> Wouldn't this hard code source.scm in the compiled code? (yes, I'm
WP> generating scsh images for speed)
Okay, I see. But the code of source.scm will only be compiled and
stored in the image if you load/open the module SOURCE before you dump the
image. Otherwise the compiler will not look into the module's code.
--
Martin
|