[racket] Oh, load! Where art thou?
Richard, as the oldest Schemer around with an advisor nicknamed "Lispman", I used two load-based scripts like that until a couple of years ago. I rewrote it all with require and it turned out to be the right kind of improvement. It was all easier to manage.
I also used load like this for years to get into students' programs and to supply them with libraries. It seems to work in a way that no other language can provide libraries. And in a sense, teachpacks aren't close but I figured out ways to cope.
This second use case is good if you send things 'over the wire'. But again, I'd rather write a library function that reads and evals -- in exactly the sandbox I want if I had to do this. It's more secure than running raw load.
-- Matthias
On Jul 23, 2010, at 9:58 PM, Richard Cleis 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