[plt-scheme] embedding & modules problem

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Wed Apr 29 13:26:17 EDT 2009

On Wed, Apr 29, 2009 at 1:05 PM, Dave Griffiths <dave at pawfal.org> wrote:
> On Wed, 2009-04-29 at 11:26 -0400, Ryan Culpepper wrote:
>> Dave Griffiths wrote:
>> > Hi all,
>> >
>> > I'm trying to understand how modules work when created inside an
>> > embedding application. If I run the adapted 3m example below with:
>> >
>> > "(require my-module) (my-func)"
>> >
>> > It fails with:
>> >
>> > #f::9: my-module: standard-module-name-resolver: collection not found:
>> > "my-module" in any of: () in: my-module
>> >
>> > Even though the module is defined in the current environment...
>>
>> It seems like you should be using this require form instead:
>>    (require 'my-module)
>>
>> Does that help?
>
> Yes, thanks Ryan. Any reasons why it's different? Is it because the
> reader hasn't been run over the code? If so, is there a way to make this
> happen?

(require my-module) and (require 'my-module) mean two different things.

The first means load the "my-module" collection, and since no path
within the collection is given, it defaults to "main.ss".  It is
actually shorthand for (lib "main.ss" "my-module").

The second form means load a module named "my-module" that was defined
interactively (e.g. by running code, rather than by loading from a
file).  If you have run code to set up a module named "my-module" and
want to load it, you always have to use the second form (with the
quoted name).

-- 
Carl Eastlund


Posted on the users mailing list.