NameSpace.st
changeset 1908 aff3d44e4399
parent 1901 8eebbd3c7232
child 1931 5f60d3e5ba6e
equal deleted inserted replaced
1907:f0ca293ccceb 1908:aff3d44e4399
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 
    13 
    14 Class subclass:#Namespace
    14 Object subclass:#Namespace
    15 	instanceVariableNames:''
    15 	instanceVariableNames:''
    16 	classVariableNames:''
    16 	classVariableNames:''
    17 	poolDictionaries:''
    17 	poolDictionaries:''
    18 	category:'Kernel-Classes'
    18 	category:'Kernel-Classes'
    19 !
    19 !
    57 ! !
    57 ! !
    58 
    58 
    59 !Namespace class methodsFor:'instance creation'!
    59 !Namespace class methodsFor:'instance creation'!
    60 
    60 
    61 name:aSymbol
    61 name:aSymbol
       
    62     "create a new nameSpace, named aSymbol"
       
    63 
    62     |newNamespace|
    64     |newNamespace|
    63 
    65 
    64     newNamespace := super new.
    66     newNamespace := self subclass:aSymbol
    65     newNamespace setName:aSymbol.
    67 			 instanceVariableNames:''
    66     newNamespace category:'* namespaces *'.
    68 			 classVariableNames:''
    67     Smalltalk at:aSymbol put:newNamespace.
    69 			 poolDictionaries:''
    68     Smalltalk changed.
    70 			 category:(aSymbol , ' (* namespace *)').
       
    71 
    69     ^ newNamespace
    72     ^ newNamespace
    70 
    73 
    71     "
    74     "
    72      Namespace name:'foo'
    75      Namespace name:'foo'
    73      (Namespace name:'foo') category:'my name space'
    76      (Namespace name:'foo') category:'my name space'
    76 
    79 
    77 new
    80 new
    78     self error:'namespaces are not to be created with new'
    81     self error:'namespaces are not to be created with new'
    79 ! !
    82 ! !
    80 
    83 
    81 !Namespace methodsFor:'accessing'!
    84 !Namespace class methodsFor:'accessing'!
    82 
    85 
    83 at:classNameSymbol
    86 at:classNameSymbol
    84     ^ self privateClassesAt:classNameSymbol
    87     ^ self privateClassesAt:classNameSymbol
    85 !
    88 !
    86 
    89 
    96 
    99 
    97 at:classNameSymbol put:aClass
   100 at:classNameSymbol put:aClass
    98     ^ self privateClassesAt:classNameSymbol put:aClass
   101     ^ self privateClassesAt:classNameSymbol put:aClass
    99 ! !
   102 ! !
   100 
   103 
   101 !Namespace methodsFor:'enumerating'!
   104 !Namespace class methodsFor:'enumerating'!
   102 
   105 
   103 allBehaviorsDo:aBlock
   106 allBehaviorsDo:aBlock
   104     self privateClassesDo:aBlock
   107     self privateClassesDo:aBlock
   105 
   108 
   106     "Created: 26.10.1996 / 12:29:01 / cg"
   109     "Created: 26.10.1996 / 12:29:01 / cg"
   107 ! !
   110 ! !
   108 
   111 
   109 !Namespace methodsFor:'fileOut'!
   112 !Namespace class methodsFor:'fileOut'!
   110 
   113 
   111 basicFileOutDefinitionOn:aStream
   114 basicFileOutDefinitionOn:aStream
   112     aStream nextPutAll:('Namespace name:' , name storeString)
   115     aStream nextPutAll:('Namespace name:' , self name storeString)
   113 ! !
   116 ! !
   114 
   117 
   115 !Namespace methodsFor:'queries'!
   118 !Namespace class methodsFor:'queries'!
   116 
   119 
   117 isNamespace
   120 isNamespace
   118     ^ true
   121     ^ true
   119 
   122 
   120     "Created: 26.10.1996 / 11:13:36 / cg"
   123     "Created: 26.10.1996 / 11:13:36 / cg"
   121 ! !
   124 ! !
   122 
   125 
   123 !Namespace class methodsFor:'documentation'!
   126 !Namespace class methodsFor:'documentation'!
   124 
   127 
   125 version
   128 version
   126     ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.4 1996-11-05 22:21:29 cg Exp $'
   129     ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.5 1996-11-06 20:42:22 cg Exp $'
   127 ! !
   130 ! !