namespace itself is not a namespace
authorClaus Gittinger <cg@exept.de>
Fri, 20 Dec 1996 21:12:26 +0100
changeset 2007 57434c08d720
parent 2006 7ae5a89ed40a
child 2008 381a5160be9a
namespace itself is not a namespace
NameSpace.st
Namespace.st
--- a/NameSpace.st	Fri Dec 20 01:14:43 1996 +0100
+++ b/NameSpace.st	Fri Dec 20 21:12:26 1996 +0100
@@ -59,7 +59,7 @@
 !Namespace class methodsFor:'instance creation'!
 
 fullName:aFullNameSpacePathName
-    "given a pissibly nested name of a namespace, create all required
+    "given a possibly nested name of a namespace, create all required
      intermediate spaces (if not already existing) and return the
      bottom-level space."
 
@@ -124,19 +124,20 @@
     ^ thisNamespace
 
     "Created: 8.11.1996 / 13:41:59 / cg"
+    "Modified: 20.12.1996 / 15:17:07 / cg"
 !
 
-name:aSymbol
-    "create a new nameSpace, named aSymbol"
+name:aStringOrSymbol
+    "create a new nameSpace, named aStringOrSymbol"
 
     |newNamespace|
 
-    (aSymbol includes:$:) ifTrue:[
+    (aStringOrSymbol includes:$:) ifTrue:[
         self error:'invalid namespace name'.
         ^ nil.
     ].
 
-    newNamespace := self subclass:aSymbol
+    newNamespace := self subclass:aStringOrSymbol asSymbol
                          instanceVariableNames:''
                          classVariableNames:''
                          poolDictionaries:''
@@ -147,9 +148,10 @@
     "
      Namespace name:'foo'
      (Namespace name:'foo') category:'my name space'
+     foo at:#bar put:(Metaclass new new)
     "
 
-    "Modified: 8.11.1996 / 13:40:03 / cg"
+    "Modified: 20.12.1996 / 15:21:02 / cg"
 !
 
 new
@@ -162,6 +164,16 @@
 
 !Namespace class methodsFor:'accessing'!
 
+allClasses
+    |classes|
+
+    classes := IdentitySet new.
+    self allBehaviorsDo:[:aClass | classes add:aClass].
+    ^ classes
+
+    "Modified: 20.12.1996 / 15:34:50 / cg"
+!
+
 at:classNameSymbol
     "return a class from the namespace defined by the receiver"
 
@@ -224,10 +236,13 @@
     "return a printed represenation - here, a reminder is appended,
      that this is not a regular class"
 
+    self == Namespace ifTrue:[
+        ^ super displayString
+    ].
     ^ self name , ' (* namespace *)'
 
     "Created: 8.11.1996 / 21:37:24 / cg"
-    "Modified: 8.11.1996 / 21:38:41 / cg"
+    "Modified: 20.12.1996 / 15:11:31 / cg"
 ! !
 
 !Namespace class methodsFor:'queries'!
@@ -235,14 +250,15 @@
 isNamespace
     "return true - I am a namespace"
 
+    self == Namespace ifTrue:[^ false].
     ^ true
 
     "Created: 26.10.1996 / 11:13:36 / cg"
-    "Modified: 8.11.1996 / 21:38:14 / cg"
+    "Modified: 20.12.1996 / 15:11:45 / cg"
 ! !
 
 !Namespace class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.9 1996-11-08 20:49:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.10 1996-12-20 20:12:26 cg Exp $'
 ! !
--- a/Namespace.st	Fri Dec 20 01:14:43 1996 +0100
+++ b/Namespace.st	Fri Dec 20 21:12:26 1996 +0100
@@ -59,7 +59,7 @@
 !Namespace class methodsFor:'instance creation'!
 
 fullName:aFullNameSpacePathName
-    "given a pissibly nested name of a namespace, create all required
+    "given a possibly nested name of a namespace, create all required
      intermediate spaces (if not already existing) and return the
      bottom-level space."
 
@@ -124,19 +124,20 @@
     ^ thisNamespace
 
     "Created: 8.11.1996 / 13:41:59 / cg"
+    "Modified: 20.12.1996 / 15:17:07 / cg"
 !
 
-name:aSymbol
-    "create a new nameSpace, named aSymbol"
+name:aStringOrSymbol
+    "create a new nameSpace, named aStringOrSymbol"
 
     |newNamespace|
 
-    (aSymbol includes:$:) ifTrue:[
+    (aStringOrSymbol includes:$:) ifTrue:[
         self error:'invalid namespace name'.
         ^ nil.
     ].
 
-    newNamespace := self subclass:aSymbol
+    newNamespace := self subclass:aStringOrSymbol asSymbol
                          instanceVariableNames:''
                          classVariableNames:''
                          poolDictionaries:''
@@ -147,9 +148,10 @@
     "
      Namespace name:'foo'
      (Namespace name:'foo') category:'my name space'
+     foo at:#bar put:(Metaclass new new)
     "
 
-    "Modified: 8.11.1996 / 13:40:03 / cg"
+    "Modified: 20.12.1996 / 15:21:02 / cg"
 !
 
 new
@@ -162,6 +164,16 @@
 
 !Namespace class methodsFor:'accessing'!
 
+allClasses
+    |classes|
+
+    classes := IdentitySet new.
+    self allBehaviorsDo:[:aClass | classes add:aClass].
+    ^ classes
+
+    "Modified: 20.12.1996 / 15:34:50 / cg"
+!
+
 at:classNameSymbol
     "return a class from the namespace defined by the receiver"
 
@@ -224,10 +236,13 @@
     "return a printed represenation - here, a reminder is appended,
      that this is not a regular class"
 
+    self == Namespace ifTrue:[
+        ^ super displayString
+    ].
     ^ self name , ' (* namespace *)'
 
     "Created: 8.11.1996 / 21:37:24 / cg"
-    "Modified: 8.11.1996 / 21:38:41 / cg"
+    "Modified: 20.12.1996 / 15:11:31 / cg"
 ! !
 
 !Namespace class methodsFor:'queries'!
@@ -235,14 +250,15 @@
 isNamespace
     "return true - I am a namespace"
 
+    self == Namespace ifTrue:[^ false].
     ^ true
 
     "Created: 26.10.1996 / 11:13:36 / cg"
-    "Modified: 8.11.1996 / 21:38:14 / cg"
+    "Modified: 20.12.1996 / 15:11:45 / cg"
 ! !
 
 !Namespace class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/Namespace.st,v 1.9 1996-11-08 20:49:06 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/Namespace.st,v 1.10 1996-12-20 20:12:26 cg Exp $'
 ! !