[squeak-dev] Environments: Import order
Chris Muller
asqueaker at gmail.com
Fri Dec 20 22:07:37 UTC 2013
Oh, so that's my problem then, I see the sequence of import:'s as
defining the search path, just like in Java imports. I fail to
understand what is different about this kind of import...
....
Ok, I think I got it by asking myself, should Smalltalk be first in
the import list or last? Answer: First. Because you're "building
up" a name space a la inheritance.
And, this gives the ability to override names that might be in Smalltalk..
On Fri, Dec 20, 2013 at 3:56 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> If both Griffle and Plonk provide Feep, I expect to get Plonk's Feep, not Griffle's, or worse, a Feep that was defined even before Griffle or Plonk. So to me the order makes sense.
>
> Importing is very different from a search path, which indeed would be resolved the other way around.
>
> - Bert -
>
> On 20.12.2013, at 22:49, Chris Muller <asqueaker at gmail.com> wrote:
>
>> Plus, the way the API is used
>>
>> myEnvironment
>> import: #Griffle ;
>> import: #Plonk
>>
>> looks more like a chain-of-responsibility list.. Not that Plonk
>> "wraps" Griffle..
>>
>> On Fri, Dec 20, 2013 at 3:35 PM, Chris Muller <asqueaker at gmail.com> wrote:
>>> Well, it's backward from how name-resolutions works in other languages
>>> like Java, isn't it?
>>>
>>> On Fri, Dec 20, 2013 at 3:03 PM, Frank Shearar <frank.shearar at gmail.com> wrote:
>>>> On 20 December 2013 20:40, Chris Muller <asqueaker at gmail.com> wrote:
>>>>> One thing I just noticed is that the #import... methods on Environment
>>>>> seem to chain the imports in order they are added. This means the
>>>>> last-added is first-searched when resolving names.
>>>>>
>>>>> Seems like first import should be first-searched...?
>>>>
>>>> I think the behaviour's the correct one: adding imports is like
>>>> wrapping a present in layers of paper: the last added layer/import is
>>>> the outermost layer.
>>>>
>>>> frank
>>>>
>>
>
>
More information about the Squeak-dev
mailing list
|