<br><br>On Tue, Jun 26, 2012 at 8:38 AM, Chris Muller &lt;<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>&gt; wrote:<br>&gt; It sounds like a simple solution -- I do appreciate it&#39;s a pure OO<br>&gt; solution rather introducing new syntax.<br>
&gt;<br>&gt; However, things tend to &quot;sound&quot; simple when I barely understand them.<br>&gt; Perhaps a concrete example would help me -- the basic use-case:<br>&gt; pretend I have an application called &quot;Application&quot; that wants to use<br>
&gt; both Magma and Seaside in the same image and each wants to define a<br>&gt; &quot;Session&quot; class.  They are developed by different developers.  In this<br>&gt; context, could you clarify some questions?<br><br>Sure, that sounds like a great use-case for Environments.<br>
<br>&gt;  - Somewhere, the Application would need to define the &quot;order&quot; of the<br>&gt; Environments it depends on so it can sometimes use unqualified names,<br>&gt; is this correct?  What would that code look like?<br>
<br>Yes, that does need to be defined, but that definition shouldn&#39;t be part of Application. Application should just refer to the classes it needs and leave it up the environment to know where they are. That means that environment management is done in your development tools, and when building images. To set up the environments for Application you might do something like this:<br>
<br><span class="Apple-style-span" style="font-family:&#39;courier new&#39;,monospace">  (Environment name: &#39;Seaside&#39;)</span><font class="Apple-style-span" face="&#39;courier new&#39;, monospace"><div><div>    importSmalltalk;</div>
<div>    fileIn: &#39;Seaside.st&#39;.</div><div><br></div><div>  (Environment name: &#39;Magma&#39;)</div><div>    importSmalltalk;</div><div>    fileIn: &#39;Magma.st&#39;.</div><div><br></div><div>  (Environment name: &#39;Application&#39;)</div>
<div>    importSmalltalk;</div><div>    import: #Seaside;</div><div>    import: #Magma;</div><div>    fileIn: &#39;Application.st&#39;.</div></div><div><br></div></font>&gt;  - What would the loading/initialization code look like that would<br>
&gt; put Magma&#39;s Session into its own environment?<br><br><div>You&#39;d load all of Magma into the it&#39;s own environment, as above.</div><div><br>&gt;  - What would the code to access Magma&#39;s Session (instead of<br>
&gt; Seasides) look like from within one of Magma&#39;s methods?<br><br></div><div>From a design perspective, we don&#39;t want Seaside or Magma to depend on each other. (Note that the Seaside and Magma environments don&#39;t import each other.) So within the Seaside and Magma environments, Session is unambiguous, and can just be referred to directly:</div>
<div><br></div><div><font class="Apple-style-span" face="&#39;courier new&#39;, monospace">  Session new</font></div><div><br>&gt;  - What would the code to access Magma&#39;s Session (instead of<br>&gt; Seasides) look like from within one of Application&#39;s methods?<br>
<br></div><div>Ok, this is the bit that&#39;s slightly tricky. Application needs to use both Seaside sessions and Magma sessions, so we need to disambiguate. Application code should just use arbitrary names, like WASession and MaSession, or SeasideSession and MagmaSession if that&#39;s more aesthetically pleasing. Then it&#39;s up to the environment to sort them out. We&#39;d do something like this:</div>
<div><br></div><div><div style="font-family:&#39;courier new&#39;,monospace">  (Environment name: &#39;Application&#39;)</div><div style="font-family:&#39;courier new&#39;,monospace">    importSmalltalk;</div><div style="font-family:&#39;courier new&#39;,monospace">
    import: #Seaside aliases: {#Session -&gt; #SeasideSession};</div><div style="font-family:&#39;courier new&#39;,monospace">    import: #Magma aliases: {#Session -&gt; #MagmaSession};</div><div style="font-family:&#39;courier new&#39;,monospace">
    fileIn: &#39;Application.st&#39;.</div><div style="font-family:&#39;courier new&#39;,monospace"><br></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">Note that I haven&#39;t implemented imports (except for Smalltalk) or aliasing yet, so the protocol might end up being different.</font></div>
<div style="font-family:&#39;courier new&#39;,monospace"><br></div></div><div>&gt;  - What would the code to access Magma&#39;s Session (instead of<br>&gt; Seasides) look like from a workspace (Global environment?)<br><br>
</div><div>The workspace would have an environment as well, and there&#39;s be some UI for manipulating it. So Magma&#39;s session might be called Session or MagmaSession, or whatever is convenient for that workspace. We might even do some kind of automatic importing similar to the way undeclared variables work are handled.</div>
<div><br>Great questions Chris, thanks.</div><div><br></div><div>Colin</div>