[plt-scheme] dynamic-require module question
I guess I could also use eval, and instead of reading straight from the
file, read from something like:
(input-port-append #t
(open-input-string "(module \"custom-language.scm\" ")
(open-input-file "file1.cust-lang")
(open-input-string ")"))
Though in that case I'd like to find a way to adjust the positions in
the syntax objects, so that any error messages reflect the positions in
"file1.cust-lang".
Rob
Matthew Flatt wrote:
> At Tue, 15 May 2007 18:31:26 -0400, Robert Nikander wrote:
>> If I want to load files defined in a custom language, is there a way
>> that I can skip the module form? In other words, can I replace this:
>>
>> --- file1.cust-lang ---
>> (module "custom-language.scm"
>> a b c)
>> --- load-it.scm ---
>> (dynamic-require "file1.newlang")
>> ---
>>
>> with something like this:
>>
>> --- file1.cust-lang ---
>> a b c
>> --- load-it.scm ---
>> (dynamic-require-??? "file1.newlang" "custom-language.scm")
>
> No, not currently. You can trade the `(module ...)' wrapper for a
> `#reader' prefix, like this:
>
> --- file1.cust-lang ---
> #reader("custom-language-reader.scm")
> a b c
>
> but that's as far as it goes.
>
> `require' might one day support a mapping from file suffixes to
> implicit `#reader' headers, but I'm not sure.
>
> Matthew
>
>