[racket] Oh, load! Where art thou?

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Jul 23 22:06:58 EDT 2010

The short answer: load really has no place. Use require (and provide).

The slightly longer answer: load is simply just reading in expressions
and calling eval on them, one at a time. So you really want to know
what 'eval' does. There is a section on this in the Guide that is a
good starting point (technically the answer to your question is that
your variables go into the namespace that find in current-namespace...
but that's not so helpful without a bunch of more reading).

hth,
Robby

On Fri, Jul 23, 2010 at 8:58 PM, Richard Cleis <rcleis at mac.com> wrote:
> Given a file of "some-scheme.rxt":
>
> *********************
> ;#lang racket
>
> (define a-var 'a-val)
> *********************
>
> and a program in a definitions window:
>
> *********************
> #lang racket
>
> (define (f) (load "some-scheme.rkt"))
> ;(f)
> *********************
>
> ... Entering (f) in the interactions window defines a-var.
>
> If the comment is removed from ;#lang racket, a-var is not defined.  Where did it go?
>
> If the comment is removed from ;(f), an 'unbound identifier' error is triggered during the Run. [(f) still works in the interactions window.] Which identifier is unbound?
>
> How can I explain where (load) evaluates it's contents?
>
> Does (load) have a future in racket?
>
> rac
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.