Squeak and Namespaces
Klaus D. Witzel
klaus.witzel at cobss.com
Thu Nov 30 02:21:07 UTC 2006
on Thu, 30 Nov 2006 01:19:41 +0100, you wrote:
> Giovanni Corriga <giovanni at corriga.net> wrote:
>> Il giorno gio, 30/11/2006 alle 12.07 +1300, Michael van der Gulik ha
>> > On 11/29/06, Klaus D. Witzel <klaus.witzel at cobss.com> wrote:
>> > Motivation for syntax: we say SmallInteger and LargeInteger to
>> > subclasses
>> > of Integer and obviously prefer the opposite direction for a
>> > namespace
>> > hierarchy. Let's replace the suggested :: by a legitimate
>> > binary message
>> > Morphic >~ View
>> > Tweak >~ View
>> > System >~ Default >~ Compiler
>> > My >~ Terrific >~ Compiler
>> > Implementing Namespaces like this would mean that your code runs
>> > slower. In order to refer to a class, you'll need to send a message to
>> > a Namespace every time you refer to it, rather than just refer to the
>> > class directly.
>> > Also, your message names are capitalised, which will have a negative
>> > affect on your karma.
>> Isn't this what Henryk's Environments do?
> Henrik, not Henryk. And I would probably say Dan's/Henrik's Environments
> - Dan started that path and Henrik tried to fulfil it.
> Personally I think it is too complicated - I dislike hierarchies in
> general :).
My mistake: I wrote "hierarchy" but in fact the space is organized like
the space in Trait (users of a trait composition and the composition's
> But yes, the idea was to use late binding using message
> sends etc.
No, this was not my idea. The compiler reduces the #>~ message symbol:
(A >~ B) "results in"
(Association key: #B value: B) "which is a component of A"
For namespace maintenance:
(A >~ B) moveToNamespace: C. "next line still refers to same B"
(A >~ B) namespace shallowCopy moveToNamespace: D.
(C >~ B) = (D >~ B) "true"
> In fact, using my Namespaces you can do both I guess. We could implement
> a DNU on class Namespace and that would be it. They are already reified
> globals hanging in Smalltalk under their own name.
> And right, I started on that Detailed walktrough I promised - but I only
> got through the "core" part and actually found an issue and also need to
> study some parts of it more to get it all nailed down. If you file that
> core part into say a 3.7 image the idea was that you could then create
> classes like Foo::Bar and use them (and thus be able to file in new code
> written with these namespaces). But the method #scopeVariable needs to
> be different for this to work - it expects to find an instance of
> Namespace called #Foo in Smalltalk - which of course will not be there.
> But here is the current draft:
> regards, Göran
More information about the Squeak-dev