--- a/NameSpace.st Thu Jan 02 15:28:42 1997 +0100
+++ b/NameSpace.st Thu Jan 02 18:42:17 1997 +0100
@@ -133,10 +133,20 @@
name:aStringOrSymbol
"create a new nameSpace, named aStringOrSymbol"
- |newNamespace existing|
+ |newNamespace existing ok|
- (aStringOrSymbol includes:$:) ifTrue:[
- self error:'invalid namespace name'.
+ ok := aStringOrSymbol first isLetter.
+ ok ifTrue:[
+ 2 to:aStringOrSymbol size do:[:idx | |ch|
+ ch := aStringOrSymbol at:idx.
+ ok ifTrue:[
+ ok := ch isLetterOrDigit or:[ch == $_].
+ ]
+ ]
+ ].
+
+ ok ifFalse:[
+ self error:'invalid namespace name (must be a valid identifier)'.
^ nil.
].
@@ -158,7 +168,7 @@
foo at:#bar put:(Metaclass new new)
"
- "Modified: 23.12.1996 / 13:13:41 / cg"
+ "Modified: 2.1.1997 / 18:41:22 / cg"
!
new
@@ -267,5 +277,5 @@
!Namespace class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.12 1996-12-23 12:20:43 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.13 1997-01-02 17:42:17 cg Exp $'
! !