[racket] `provide` failed under `#lang racket/load`
On Sun, Aug 4, 2013 at 10:20 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> Yi,
>
> Most #lang languages implicitly create a module from the contents of the
> file. #lang racket/load, on the other hand, runs the contents of the file
> as top-level terms outside of any module. The provide form is not legal at
> the top level, as it is meaningless -- there's no module to provide things
> from. You need to either switch back to #lang racket or remove the
> provide, depending on what you're trying to accomplish.
>
Thanks for the answer, Karl. I also found the answer in the doc:
http://docs.racket-lang.org/reference/load-lang.html. But very
confusingly, the doc keeps saying "racket/load" module.
>
> Carl Eastlund
>
>
> On Sun, Aug 4, 2013 at 4:12 AM, Yi Dai <plmday at gmail.com> wrote:
>
>> Hi,
>>
>>
>> I have the following code in a file named `foo.rkt`:
>>
>> ```
>> #lang racket/load
>>
>> (provide foo)
>>
>> (define foo 'bar)
>> ```
>>
>> When trying to run the code, I got the following confusing error:
>>
>> > `provide`: not at module level in: `(provide foo)`
>>
>> What does this mean? Why `provide` is not at module level?
>> Use `#lang racket` instead does not pose this problem. I am
>> confused. Any idea?
>>
>>
>> Yours truly,
>>
>> Yi
>>
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130804/ef5bb8bc/attachment.html>