[Traits] Namespaces(environments?), SystemChangeNotifier, ...

Klaus D. Witzel klaus.witzel at cobss.com
Mon Apr 24 18:10:08 UTC 2006


Hi Göran,

on Mon, 24 Apr 2006 13:26:40 +0200, you wrote:

> ...
> My Namespaces code (hmmm, did I update it on SM? Nope, doesn't look that
> way, sorry, will put it up there) was refreshed to work in 3.9 when I
> was in Brussels recently and presented it to the people attending that
> Smalltalk party. Other people attending can comment on it - but
> unfortunately I managed to break the code right before the talk so I
> couldn't demo it - but it worked 30 minutes later when I discovered what
> I had done. ;)
>
> I very much want to make that code as good as possible so that the
> community can decide if we want to use it or not. I personally think it
> is a simple and very nice way of dealing with the problem. There are
> also numerous writeups about it, the latest here:
>
> 	http://swiki.krampe.se/gohu/32

Ah, that's a good one. Comes close to what we have in mind, i.e. let the  
compiler do it:
!SystemDictionary methodsFor: 'namespace support'!
>> aSymbol

	^ self at: aSymbol! !

...which is complemented by new method #traitCompositionString, in which  
names are automagically prefixed, like
	^ self environment == Smalltalk
		ifTrue: [self name]
		ifFalse: ['(', (Smalltalk keyAtValue: environment), '>>',  self name,  
')'] ! !

> Note that my solution does not attempt to solve All Aspects Under The
> Sun Related To Whatever People Think Of When You Mention The Word
> Namespace, but only a rather well defined subset in a well defined and
> backwards compatible way. :)

:)

/Klaus




More information about the Squeak-dev mailing list