[racket-dev] dynamic require and collapsed snips?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Sun Sep 11 14:38:16 EDT 2011

Let's say that I have a graphical file "snips.rkt" with the following content:

;;;;;;;;;;;;;;;;;;;;;;;;;;;
#lang racket/base
(define (f x) (...))
;;;;;;;;;;;;;;;;;;;;;;;;;;;

where (...) is an s-expression that's been collapsed by editing the
file in DrRacket, right clicking the expression, and selecting
"Collapse S-expression".

I then create a test.rkt to try to dynamically require the file.

#lang racket/base
(parameterize ([current-namespace (make-base-namespace)])
  (dynamic-require '(file "snips.rkt") #f))


When I run test.rkt in DrRacket, it runs successfully.  However, if I
try running it from the terminal, I get the following error:

###############################################################
cslab9g ~/work/whalesong $ racket test1.rkt
read-syntax: cannot load snip-class reader: #"(lib
\"collapsed-snipclass.ss\" \"framework\")"

 === context ===
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:381:2: find-class
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:207:2: read-snip
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:616:4: read-proc
/local/projects/racket/releases/5.1.3/collects/mzlib/port.rkt:168:4: do-read-it
/local/projects/racket/releases/5.1.3/collects/syntax/module-reader.rkt:176:17:
body
/local/projects/racket/releases/5.1.3/collects/syntax/module-reader.rkt:173:2:
wrap-internal
lang:read-syntax
/local/projects/racket/releases/5.1.3/collects/wxme/wxme.rkt:694:2:
wxme-read-syntax
standard-module-name-resolver
/gpfs/main/home/dyoo/work/whalesong/test1.rkt: [running body]
###############################################################


So there must be some context that I'm missing here.  What should I be
doing to not get this error at the terminal?  Thanks!


Posted on the dev mailing list.