A little namespace "proposal"
Avi Bryant
avi at beta4.com
Wed Apr 14 22:49:34 UTC 2004
On Apr 14, 2004, at 3:43 PM, Bert Freudenberg wrote:
> Am 15.04.2004 um 01:23 schrieb goran.krampe at bluefish.se:
>
>> (Smalltalk at: #Fruits::Apple) == ((Smalltalk at: #Fruits) at:
>> #Apple)
>>
>> The left hand shows that SystemDictionary has some "compatibility
>> behaviour" making it seem as if the qualified names are all accessible
>> "flat" in Smalltalk, which they aren't. It will do a two step lookup
>> like the right hand shows.
>>
>> ((Smalltalk at: #Fruits) at: #Apple) == Fruits::Apple
>>
>> Here the right hand shows that Scanner/Parser has been augmented to
>> properly handle qualified names (with a little help from Andreas).
>
> Does that mean I can not enumerate all classes in the system by
> looking at the entries in Smalltalk? What about the invariant
>
> (Smalltalk at: aClass name) == aClass
>
> If this does not hold, many tools would have to be made
> namespace-aware. This can be elegantly avoided when using the
> fully-qualified name as actual class name. I thought your original
> proposal did this?
Yeah, I'm with Bert. Much better to have the "compatibility behavior"
go the other way - that is, rather than "virtualizing" the
SystemDictionary so that
Smalltalk at: #Fruits::Apple
is implemented with a two level lookup:
(Smalltalk at: #Fruits) at: #Apple,
you should instead virtualize the namespaces so that
(Smalltalk at: #Fruits) at: #Apple
does the fully qualified lookup:
Smalltalk at: #Fruits::Apple.
This requires *way* less modification of existing tools and code.
I, too, thought this was the idea all along.
Avi
More information about the Squeak-dev
mailing list
|