Object.st
changeset 925 020a15fa450f
parent 899 ddcdb74e52de
child 983 86239edb7b7d
--- a/Object.st	Fri Feb 02 11:17:29 1996 +0100
+++ b/Object.st	Fri Feb 02 11:49:52 1996 +0100
@@ -1554,12 +1554,24 @@
 
     [
 	deps := self dependents.
+
+	"/ to save a fair amount of memeory in case of
+	"/ many dependencies, we store a single dependent in
+	"/ a WeakArray, and switch to a WeakSet if more dependents are
+	"/ added.
+
 	deps isNil ifTrue:[
-	    self dependents:(WeakIdentitySet with:anObject)
+	    self dependents:(WeakArray with:anObject)
 	] ifFalse:[
-	    deps add:anObject
+	    deps class == WeakArray ifTrue:[
+		self dependents:(WeakIdentitySet with:(deps at:1) with:anObject)
+	    ] ifFalse:[
+		deps add:anObject
+	    ]
 	]
     ] valueUninterruptably
+
+    "Modified: 2.2.1996 / 11:04:31 / cg"
 !
 
 dependents
@@ -1611,9 +1623,25 @@
     [
 	deps := self dependents.
 	deps notNil ifTrue:[
-	    deps remove:anObject ifAbsent:[].
-	    deps isEmpty ifTrue:[
-		self dependents:nil
+
+	    "/ to save a fair amount of memeory in case of
+	    "/ many dependencies, we store a single dependent in
+	    "/ a WeakArray, and switch to a WeakSet if more dependents are
+	    "/ added.
+
+	    deps class == WeakArray ifTrue:[
+		(deps at:1) == anObject ifTrue:[
+		    self dependents:nil
+		]
+	    ] ifFalse:[
+		deps remove:anObject ifAbsent:[].
+		deps isEmpty ifTrue:[
+		    self dependents:nil
+		] ifFalse:[
+		    deps class == WeakArray ifTrue:[
+			self dependents:(WeakArray with:(deps first))
+		    ]
+		]
 	    ]
 	]
     ] valueUninterruptably
@@ -4091,12 +4119,18 @@
     "launch a confirmer, which allows user to enter yes or no.
      return true for yes, false for no"
 
+    "
+     on systems without GUI, or during startup, output a message
+     and return true (as if yes was answered)
+     Q: should we ask user by reading Stdin ?
+    "
+    Smalltalk isInitialized ifFalse:[
+	'confirmation: ' print. aString print.
+	'continue, assuming <yes>' printNL.
+	^ true
+    ].
+
     Dialog isNil ifTrue:[
-	"
-	 on systems without GUI, output a message
-	 and return true (as if yes was answered)
-	 Q: should we ask user by reading Stdin ?
-	"
 	Transcript showCr:aString.
 	Transcript showCr:'continue, assuming <yes>'.
 	^ true
@@ -4253,6 +4287,6 @@
 !Object class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.89 1996-01-25 15:54:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.90 1996-02-02 10:49:52 cg Exp $'
 ! !
 Object initialize!