Dear Racketeers,

I’m writing about difficulties using make-evaluator in Racket v7.0 with a 
module that selectively (or not) re-exports bindings from an existing language. 
This is related to work I’m doing with the handin server.

- the short version -

Create this file, and use as follows:

;;;;; beginner-lang.rkt ;;;;;

#lang racket

(require lang/htdp-beginner)
(provide (all-from-out lang/htdp-beginner))

;;;;; Interactions, launched from the same directory: ;;;;;

> (require racket/sandbox)
> (make-evaluator "beginner-lang.rkt")
. . ../../../../../../../../Applications/Racket 
v7.0/collects/racket/private/kw-file.rkt:102:2: open-input-file: `read' access 
denied for /Users/jteach/Library/Racket/7.0/pkgs/.LOCKpkgs.rktd

;;;;; end code ;;;;;

Q: Can you tell me why I’m seeing this behavior?

- the longer version, with context -

After a couple years of just having my small classes email me their work, I’m 
trying the handin server again. For the next assignment, students are writing 
BSL code that uses 2htdp/image and the animate function from 2htdp/universe. 
Their code also uses bitmap/url to load an image I provided via the class 

In doing a trial run of submitting my test solutions, I found my checker.rkt 
signaling errors from the check: form: Using :language '(special 
htdp-beginner), I get an error from the student’s (require 2htdp/image) line, 
saying that image? is being imported twice.

Q: How do I make the import “just work”, as it ordinarily does in DrRacket?

Going further, I’ve kludged together a wrapper lib that imports all the needed 
functions while taking care to remove clashes, at which point I got the odd 
read-access error above. Here’s that code:

;;;;; img.rkt ;;;;;

#lang racket

(require racket/require) ; for subtract-in

(require (combine-in [except-in lang/htdp-beginner require image?]
                     [subtract-in [except-in 2htdp/image bitmap/url]
(provide (all-from-out lang/htdp-beginner)
         (all-from-out 2htdp/image)
         (rename-out [%require require]))

(define-syntax-rule (%require . blahblah) (void)) ; ignore student's requires

(define (animate _) (void)) ; ignore student's calls to animate from universe

(define (bitmap/url url) ; replace bitmap/url with something harmless
  (rectangle 50 35 'solid 'lavender))

;;;;; end img.rkt; I am using it in checker.rkt as follows: ;;;;;

(check: :language "../../img.rkt"  ; escape to assignment base dir

;;;;; end ;;;;;

This approach works for now, but seems like an ungainly way to do it, and I’ll 
be surprised if this level of manual disambiguation is what everybody’s been 
doing for years. Is there a more elegant way?


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to