equal
deleted
inserted
replaced
131 ! |
131 ! |
132 |
132 |
133 name:aStringOrSymbol |
133 name:aStringOrSymbol |
134 "create a new nameSpace, named aStringOrSymbol" |
134 "create a new nameSpace, named aStringOrSymbol" |
135 |
135 |
136 |newNamespace existing| |
136 |newNamespace existing ok| |
137 |
137 |
138 (aStringOrSymbol includes:$:) ifTrue:[ |
138 ok := aStringOrSymbol first isLetter. |
139 self error:'invalid namespace name'. |
139 ok ifTrue:[ |
|
140 2 to:aStringOrSymbol size do:[:idx | |ch| |
|
141 ch := aStringOrSymbol at:idx. |
|
142 ok ifTrue:[ |
|
143 ok := ch isLetterOrDigit or:[ch == $_]. |
|
144 ] |
|
145 ] |
|
146 ]. |
|
147 |
|
148 ok ifFalse:[ |
|
149 self error:'invalid namespace name (must be a valid identifier)'. |
140 ^ nil. |
150 ^ nil. |
141 ]. |
151 ]. |
142 |
152 |
143 (existing := Smalltalk at:aStringOrSymbol asSymbol) notNil ifTrue:[ |
153 (existing := Smalltalk at:aStringOrSymbol asSymbol) notNil ifTrue:[ |
144 ^ existing |
154 ^ existing |
156 Namespace name:'foo' |
166 Namespace name:'foo' |
157 (Namespace name:'foo') category:'my name space' |
167 (Namespace name:'foo') category:'my name space' |
158 foo at:#bar put:(Metaclass new new) |
168 foo at:#bar put:(Metaclass new new) |
159 " |
169 " |
160 |
170 |
161 "Modified: 23.12.1996 / 13:13:41 / cg" |
171 "Modified: 2.1.1997 / 18:41:22 / cg" |
162 ! |
172 ! |
163 |
173 |
164 new |
174 new |
165 "catch new - namespaces are not to be created by the user" |
175 "catch new - namespaces are not to be created by the user" |
166 |
176 |
265 ! ! |
275 ! ! |
266 |
276 |
267 !Namespace class methodsFor:'documentation'! |
277 !Namespace class methodsFor:'documentation'! |
268 |
278 |
269 version |
279 version |
270 ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.12 1996-12-23 12:20:43 cg Exp $' |
280 ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.13 1997-01-02 17:42:17 cg Exp $' |
271 ! ! |
281 ! ! |