[squeak-dev] Environments

Chris Cunningham cunningham.cb at gmail.com
Fri Jun 29 04:48:38 UTC 2012


On Thu, Jun 28, 2012 at 7:00 PM, Colin Putney <colin at wiresong.com> wrote:
> On Thu, Jun 28, 2012 at 2:34 AM, Michal <michal-list at auf.net> wrote:
>>
>>>   (Environment name: 'Application')
>>>     importSmalltalk;
>>>     import: #Seaside aliases: {#Session -> #SeasideSession};
>>>     import: #Magma aliases: {#Session -> #MagmaSession};
>>>     fileIn: 'Application.st'.
>>
>> Enhancement proposal:
>>
>>  how about making this aliasing automatic, happening when the
>>  'ambiguous' class is imported to begin with? Eg when Magma is first
>>  imported (into its own environment), the system is smart enough to
>>  discover that there are two environments with a class named Session,
>>  and automatically creates an alias to both of them, by prefixing the
>>  environment name (Seaside and Magma, respectively) to the class name
>>  (SeasideSession, MagmaSession).
>>
>> All users of the Seaside and Magma environments now have access to
>> disambiguated names 'for free', without having the responsability to
>> manually maintain a list of name-clashes in the world outside
>> themselves (ie in the packages they depend on).
>
> That's a great idea. There would have to be a way to turn it off and
> keep full control, but yeah, if we have a default policy for
> disambiguating that would be really useful. Thanks, Michal!
>
> Colin
>

Well, maybe.  If I understand this right, then when you alias a class,
you refer to the alias in the code that is loaded later.  If, however,
a class was left unaliased originally (in an import) and was then
referenced in the code depending on that import, but later a NEW
environment import was introduced with the same class, then if the new
importer automatically aliased both of these, the code wouldn't know
which one to use.  Which would be unfortunate.

In your Seaside / Magma example, could you leave one Session just as
Session, and have the other aliased?

Maybe the auto-aliaser would need to detect that the new code
references a dual-defined class, and asks which one it should use?  in
other words, 'partially' auto alias.

-Another Chris


More information about the Squeak-dev mailing list