<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
&nbsp;<BR>
Thanks for replying.<BR>
&nbsp;<BR>
The reason I am doing it this way, is because it is the only way I could find to convert a string of a class into&nbsp;an input&nbsp;for new / make-object etc. (Probably comes back to the way I would have done it&nbsp;or something similar in VisualLISP.)<BR>
Why do I want to do that? Well, I was wanting a common way of creating any class of object by passing its class (and other initialisation variables) to a common function, and sending it as a string seemed&nbsp;the most useful means (as I can then use it dialogs etc..)<BR>
As I said, this is only a simplified version of what I am working on.<BR>
&nbsp;<BR>
If there is a better way to do it, I'm all ears.<BR>
&nbsp;<BR>
But.. <BR>
Why does it not work, and then work?<BR>
&nbsp;<BR>
Still learning..<BR>
&nbsp;<BR>
Tim.<BR>
<BR>&nbsp;<BR>&gt; Date: Sun, 15 Nov 2009 17:08:48 -0700<BR>&gt; From: czhu@cs.utah.edu<BR>&gt; To: tjm_22@hotmail.com<BR>&gt; CC: plt-scheme@list.cs.brown.edu<BR>&gt; Subject: Re: [plt-scheme] Compile error help<BR>&gt; <BR>&gt; Could I ask why you use `eval' here? The error is related to the way you <BR>&gt; use `eval'. Most of the time, people misuse `eval' (i.e., use eval when <BR>&gt; they shouldn't).<BR>&gt; <BR>&gt; Chongkai<BR>&gt; <BR>&gt; Tim Marchbank wrote:<BR>&gt; &gt; Hi,<BR>&gt; &gt; <BR>&gt; &gt; Here is a simplified example of the problem I am having:<BR>&gt; &gt; I open the following in DrScheme:<BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; #lang scheme<BR>&gt; &gt; (define (string-eval str) (eval (read (open-input-string str))))<BR>&gt; &gt; (define (:Object-new c)<BR>&gt; &gt; (new (string-eval c))<BR>&gt; &gt; )<BR>&gt; &gt; (define entity% (class object%<BR>&gt; &gt; (field (Colour: "Red"))<BR>&gt; &gt; (super-new)<BR>&gt; &gt; )<BR>&gt; &gt; )<BR>&gt; &gt; (define point% (class entity%<BR>&gt; &gt; (field (X: 0.0))<BR>&gt; &gt; (field (Y: 0.0))<BR>&gt; &gt; (field (Z: 0.0))<BR>&gt; &gt; (super-new)<BR>&gt; &gt; )<BR>&gt; &gt; )<BR>&gt; &gt; (define aa (:Object-new "point%"))<BR>&gt; &gt; (define ab (:Object-new "entity%"))<BR>&gt; &gt; <BR>&gt; &gt; <BR>&gt; &gt; When I run it, it comes up with the following error:<BR>&gt; &gt; <BR>&gt; &gt; compile: unbound identifier (and no #%top syntax transformer is bound) <BR>&gt; &gt; in: point%<BR>&gt; &gt; <BR>&gt; &gt; but then when I enter the last two lines into the interactions window, <BR>&gt; &gt; directly after the error, it works:<BR>&gt; &gt; <BR>&gt; &gt; &gt; (define aa (:Object-new "point%"))<BR>&gt; &gt; (define ab (:Object-new "entity%"))<BR>&gt; &gt; &gt; aa<BR>&gt; &gt; #(struct:object:point% ...)<BR>&gt; &gt; &gt; ab<BR>&gt; &gt; #(struct:object:entity% ..<BR>&gt; &gt; <BR>&gt; &gt; Why does it work one time &amp; not the other??<BR>&gt; &gt; <BR>&gt; &gt; Any help would be appreciated.<BR>&gt; &gt; <BR>&gt; &gt; Thanks<BR>&gt; &gt; <BR>&gt; &gt; Tim.<BR>&gt; &gt; <BR>&gt; &gt;<BR>&gt; &gt; ------------------------------------------------------------------------<BR>&gt; &gt; With all the lastest places, searching has never been easier. Look <BR>&gt; &gt; now! Looking to move this spring? <BR>&gt; &gt; &lt;http://clk.atdmt.com/NMN/go/157631292/direct/01/&gt;<BR>&gt; &gt; ------------------------------------------------------------------------<BR>&gt; &gt;<BR>&gt; &gt; _________________________________________________<BR>&gt; &gt; For list-related administrative tasks:<BR>&gt; &gt; http://list.cs.brown.edu/mailman/listinfo/plt-scheme<BR>&gt; &gt; <BR>&gt; <BR>                                               <br /><hr />Check out The Great Australian Pay Check now <a href='http://clk.atdmt.com/NMN/go/157639755/direct/01/' target='_new'>Want to know what your boss is paid?</a></body>
</html>