[racket] eval working in REPL but not in source file

From: Stephen Chang (stchang at ccs.neu.edu)
Date: Sat Apr 26 13:27:22 EDT 2014

This blog post by Matthew Flatt provides some more intuition for racket's
eval:

http://blog.racket-lang.org/2011/10/on-eval-in-dynamic-languages-generally.html
On Apr 26, 2014 12:57 PM, "AbdUr-RehMan" <arabdurrehman at gmail.com> wrote:

> thanks guys the anchor one works for this case, I almost tried everything
> else here
>
> http://docs.racket-lang.org/guide/eval.html?q=namespace#%28tech._namespace%29
>
> Only overlooked namespace-anchor and thats exactly what I want here,
> Thanks for indicating
>
>
> On Sat, Apr 26, 2014 at 11:56 AM, Eric Hanchrow <eric.hanchrow at gmail.com>wrote:
>
>> I suspect this falls under the rather large umbrella of "the top level
>> is hopeless".  See e.g. the first Google hit for that phrase:
>> https://gist.github.com/samth/3083053
>>
>> On Sat, Apr 26, 2014 at 8:50 AM, Philipp Dikmann <philipp at dikmann.de>
>> wrote:
>> > When I had a similar problem regarding eval and the REPL, the fine
>> folks of
>> > this mailing list pointed out that the namespace-argument of eval makes
>> all
>> > the difference, as explained here
>> >
>> http://docs.racket-lang.org/guide/eval.html?q=namespace#%28tech._namespace%29
>> >
>> > Have you tried supplying a namespace to eval, possibly obtained using
>> > define-namespace-anchor after your imports?
>> >
>> >
>> >
>> > On 26.04.14 14:57, AbdUr-RehMan wrote:
>> >
>> >
>> > eval working fine in REPL but gives "ask: unbound identifier;
>> >  also, no #%app syntax transformer is bound in: ask" error when used in
>> > source file like
>> >
>> > (require racket/include)
>> > (include "world.rkt")
>> >
>> > (eval '(ask abdur 'go 'north))
>> >
>> > I have seen various questions regarding the same eval issue on racket
>> > mailing list and in the documentation
>> > but I didn't came across a case where they touch on case like this
>> > where I am including another file and the function is defined in that
>> class.
>> >
>> > Any help would be greatly appreciated,
>> > Thanks
>> >
>> >
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>> >
>> >
>> >
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>> >
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>>
>
>
> ____________________
>   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/20140426/57ccd1d1/attachment.html>

Posted on the users mailing list.