[plt-scheme] Compile error help

From: Tim Marchbank (tjm_22 at hotmail.com)
Date: Sun Nov 15 18:49:30 EST 2009



Here is a simplified example of the problem I am having:

I open the following in DrScheme:



#lang scheme

(define (string-eval str) (eval (read (open-input-string str))))

(define (:Object-new c)
  (new (string-eval c))

(define entity% (class object%
                   (field (Colour: "Red"))

(define point% (class entity%
                  (field (X: 0.0))
                  (field (Y: 0.0))
                  (field (Z: 0.0))

(define aa (:Object-new "point%"))
(define ab (:Object-new "entity%"))



When I run it, it comes up with the following error:


compile: unbound identifier (and no #%top syntax transformer is bound) in: point%


but then when I enter the last two lines into the interactions window, directly after the error, it works:


> (define aa (:Object-new "point%"))
(define ab (:Object-new "entity%"))
> aa
#(struct:object:point% ...)
> ab
#(struct:object:entity% ...)


Why does it work one time & not the other??


Any help would be appreciated.





Looking to move this spring? With all the lastest places, searching has never been easier. Look now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20091115/edb4bc5c/attachment.html>

Posted on the users mailing list.