[plt-scheme] Compile error help

From: Chongkai Zhu (czhu at cs.utah.edu)
Date: Sun Nov 15 19:08:48 EST 2009

Could I ask why you use `eval' here? The error is related to the way you 
use `eval'. Most of the time, people misuse `eval' (i.e., use eval when 
they shouldn't).

Chongkai

Tim Marchbank wrote:
> Hi,
>  
> 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"))
>                    (super-new)
>                     )
>   )
> (define point% (class entity%
>                   (field (X: 0.0))
>                   (field (Y: 0.0))
>                   (field (Z: 0.0))
>                   (super-new)
>                  )
>    )
> (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.
>  
> Thanks
>  
> Tim.
>  
>
> ------------------------------------------------------------------------
> With all the lastest places, searching has never been easier. Look 
> now! Looking to move this spring? 
> <http://clk.atdmt.com/NMN/go/157631292/direct/01/>
> ------------------------------------------------------------------------
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>   



Posted on the users mailing list.