<br><br><div class="gmail_quote">On Thu, Jul 5, 2012 at 1:27 PM, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
On 2012-07-05, at 19:15, Colin Putney wrote:<br>
<br>
&gt; On Thu, Jul 5, 2012 at 8:11 AM, Frank Shearar &lt;<a href="mailto:frank.shearar@gmail.com">frank.shearar@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; Right. So what you&#39;re saying is that if you want proper modules, you<br>
&gt;&gt; need VM support.<br>
&gt;<br>
&gt; Not necessarily. For the next experiment, I&#39;ve been thinking about<br>
&gt; implementing selector spaces. Here&#39;s how it might work:<br>
&gt;<br>
&gt; • Each environment has its own Symbol table<br>
&gt; • The scanner delegates interning of symbols to the environment<br>
&gt; • When interning a symbol the environment searches its imports<br>
&gt; • If no imported environment has the symbol, it creates one in its own<br>
&gt; symbol table<br>
&gt;<br>
&gt; This would mean that an environment could add extension methods to<br>
&gt; classes in other environments, without colliding with other<br>
&gt; extensions. It would also make it possible to create &quot;private<br>
&gt; overrides&quot; where only code in that environment would use the override.<br>
&gt; It might be useful for sandboxing, but might not be sufficient.<br>
<br>
</div>Cool idea. Since the VM just cares about the identity of Symbols, we can have the same selector twice in one method dictionary. Each environment would send only the one from its own Symbol table.<br></blockquote><div>
<br></div><div><span class="Apple-style-span">IIRC the implementation of Selector (might be Symbol?) in David Simmons&#39; AOS and S# systems is effectively two-level.  A </span>Selector<span class="Apple-style-span"> is on object with two inst vars, one being its defining environment and the other being the selector&#39;s unique string (Symbol?).  The latter is what we think of as a Symbol right now, so any two Selector (Symbol?) objects with the same sequence of characters have the same underlying unique string (Symbol?).  Selectors are the keys in method dictionaries and the message selectors in compiled methods (and presumably are used in superclass names, but here I&#39;m not familiar enough).  David had some complex mechanism whereby selectors could match based on having the same underlying character sequence and choosing the shortest distances between their environments.  This sounds complex, but the idea of boxing a Symbol so that there&#39;s a reference to its environment looks to me to be a useful one.</span></div>
<div><span class="Apple-style-span"><br></span></div><div><span class="Apple-style-span">One could imagine using only boxed selectors for messages defined in a particular environment.  This makes introspecting easy.  A Symbol&#39;s environment would be the root environment; a Selector&#39;s would be e.g. that of its environment inst var.</span></div>
<div><span class="Apple-style-span"><br></span></div><div><span class="Apple-style-span">Note that the VM doesn&#39;t (and shouldn&#39;t) care what objects are used for selectors; SmallIntegers can be used e.g. to save space.</span></div>
<div><span class="Apple-style-span"><br></span></div><div><span class="Apple-style-span">Just 2˘</span></div><div><span class="Apple-style-span"><br></span></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im"><br>
&gt; I want to stress, though, that this is *not* part of the current<br>
&gt; proposal—it&#39;s just some ruminating about what the next experiment<br>
&gt; might be, someday.<br>
<br>
<br>
</div>Yep.<br>
<span class="HOEnZb"><font color="#888888"><br>
- Bert -<br>
<br>
<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>