Hello everyone,<div><br></div><div>I&#39;m writing a toy Scheme-ish interpreter for fun, and am trying to add some Smalltalk flavor to my Scheme system. I&#39;m running into a bootstrapping problem though, and would like to ask someone for a nudge in the right direction.</div>
<div><br></div><div>(1) I want symbols to be represented as Functions.</div><div>ie. I want to be able to do this:</div><div>(&#39;my-symbol &#39;length) returns 9</div><div>(&#39;my-symbol &#39;equals &#39;my-symbol2) returns false</div>
<div><br></div><div>(2) I want symbols to be created by calling the function SYMBOL:</div><div>(SYMBOL &#39;new &lt;internal-symbol-representation&gt;) returns a new function representing a symbol</div><div><br></div><div>
(3) I want users to be able to override the built-in SYMBOL function.</div><div>(define SYMBOL (lambda args .... new symbol definition ....))</div><div><br></div><div>I can&#39;t seem to write a system like this without falling into an infinite loop somewhere.</div>
<div><br></div><div>For example this is the last one that I ran into:</div><div><br></div><div>i. (quote asdf) is a special form that should create a symbol by calling </div><div>(SYMBOL &#39;new &lt;internal-object-which-represents-asdf&gt;)</div>
<div><br></div><div>ii. But doing that requires creating the &#39;new symbol</div><div><br></div><div>iii. Creating the &#39;new symbol requires calling </div><div>(SYMBOL &#39;new &lt;internal-object-which-represents-new&gt;)</div>
<div><br></div><div>iv. But doing that requires creating the &#39;new symbol</div><div><br></div><div>and so on.</div><div><br></div><div><br></div><div>I apologize if this seems unclear. Please ask me for clarifications if I didn&#39;t explain myself properly. I have been stuck on this sort of problem for a while now, and can&#39;t wrap my head around it.</div>
<div>  -Patrick</div>