"
COPYRIGHT (c) 1996 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
Class subclass:#Namespace
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Kernel-Classes'
!
!Namespace class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
documentation
"
A Namespace is actually a dummy class, providing a home
for its private classes. This has two advantages:
- we only need one mechanism for both namespaces
and private classes
- there are no possible conflicts between a class
and a namespace named alike.
[author:]
Claus Gittinger
[see also:]
Behavior ClassDescription Class Metaclass
PrivateMetaclass
"
! !
!Namespace class methodsFor:'instance creation'!
name:aSymbol
|newNamespace|
newNamespace := super new.
newNamespace setName:aSymbol.
newNamespace category:'* namespaces *'.
Smalltalk at:aSymbol put:newNamespace.
Smalltalk changed.
^ newNamespace
!
new
self error:'namespaces are not to be created with new'
! !
!Namespace methodsFor:'accessing'!
at:classNameSymbol
^ self privateClassesAt:classNameSymbol
!
at:classNameSymbol ifAbsent:exceptionBlock
|cls|
cls := self privateClassesAt:classNameSymbol.
cls isNil ifTrue:[
^ exceptionBlock value
].
^ cls
!
at:classNameSymbol put:aClass
^ self privateClassesAt:classNameSymbol put:aClass
! !
!Namespace methodsFor:'enumerating'!
allBehaviorsDo:aBlock
self privateClassesDo:aBlock
"Created: 26.10.1996 / 12:29:01 / cg"
! !
!Namespace methodsFor:'fileOut'!
basicFileOutDefinitionOn:aStream
aStream nextPutAll:('Namespace name:' , name storeString)
! !
!Namespace methodsFor:'queries'!
isNamespace
^ true
"Created: 26.10.1996 / 11:13:36 / cg"
! !
!Namespace class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.3 1996-10-27 14:54:34 cg Exp $'
! !