change #retractInterest* to return the retracted interests
authorStefan Vogel <sv@exept.de>
Fri, 11 Nov 2016 17:20:02 +0100
changeset 4202 88ea818849fa
parent 4201 e29dfac90a57
child 4203 defdf140ad57
child 4213 739af6adeb3a
change #retractInterest* to return the retracted interests
extensions.st
--- a/extensions.st	Tue Nov 08 15:00:48 2016 +0100
+++ b/extensions.st	Fri Nov 11 17:20:02 2016 +0100
@@ -1002,12 +1002,15 @@
 
 retractInterestIn:aspect for:someOne
     "remove the interest of someOne in the receiver changing aspect
-     (as installed with #expressInterestIn:for:sendBack:)."
+     (as installed with #expressInterestIn:for:sendBack:).
+     Answer the retracted interests."
 
     "/ for now, remove the interestConverter.
     "/ In the future, a more intelligent DependencyCollection class is planned for
 
-    self retractInterestsForWhich:[:i | (i aspect == aspect) and:[i destination == someOne]]
+    ^ self retractInterestsForWhich:[:i | 
+            (i aspect == aspect) and:[i destination == someOne]
+        ]
 
     "
      |p b|
@@ -1071,24 +1074,26 @@
 
 retractInterests
     "remove all interests in the receiver changing aspect
-     (as installed with #expressInterestIn:for:sendBack:)."
+     (as installed with #expressInterestIn:for:sendBack:).
+     Answer the retraced interests."
 
     "/ for now, remove the interestConverter.
     "/ In the future, a more intelligent DependencyCollection class is planned for
 
-    self retractInterestsForWhich:[:i | true ]
+    ^ self retractInterestsForWhich:[:i | true ]
 ! !
 
 !Object methodsFor:'dependents-interests'!
 
 retractInterestsFor:someOne
     "remove the interest of someOne in the receiver
-     (as installed with #onChangeSend:to:)."
+     (as installed with #onChangeSend:to:).
+     Answer the retracted interests."
 
     "/ for now, remove the interestConverter.
     "/ In the future, a more intelligent DependencyCollection class is planned for
 
-    self retractInterestsForWhich:[:i | i destination == someOne ]
+    ^ self retractInterestsForWhich:[:i | i destination == someOne ]
 
     "
      |p b|
@@ -1131,7 +1136,8 @@
 
 retractInterestsForWhich:aBlock
     "remove all interests in the receiver changing aspect
-     (as installed with #expressInterestIn:for:sendBack:)."
+     (as installed with #expressInterestIn:for:sendBack:).
+     Answer the retracted interests."
 
     "/ for now, remove the interestConverter.
     "/ In the future, a more intelligent DependencyCollection class is planned for
@@ -1140,29 +1146,32 @@
 
     deps := self interests.
     deps size ~~ 0 ifTrue:[
-	"/ cannot removeDependent within the loop - the interests collection rehashes
-	coll := OrderedCollection new.
-	deps do:[:dep |
-	    dep isInterestConverter ifTrue:[
-		(aBlock value:dep) ifTrue:[coll add:dep].
-	    ]
-	].
-	coll do:[:dep |
-	    self removeInterest:dep.
-	].
+        "/ cannot removeDependent within the loop - the interests collection rehashes
+        coll := IdentitySet new.
+        deps do:[:dep |
+            dep isInterestConverter ifTrue:[
+                (aBlock value:dep) ifTrue:[coll add:dep].
+            ]
+        ].
+        coll do:[:dep |
+            self removeInterest:dep.
+        ].
+        ^ coll.
     ].
+    ^ #()
 ! !
 
 !Object methodsFor:'dependents-interests'!
 
 retractInterestsIn:aspect
     "remove all interests in the receiver changing aspect
-     (as installed with #expressInterestIn:for:sendBack:)."
+     (as installed with #expressInterestIn:for:sendBack:).
+     Answer the retracted interests."
 
     "/ for now, remove the interestConverter.
     "/ In the future, a more intelligent DependencyCollection class is planned for
 
-    self retractInterestsForWhich:[:i | i aspect == aspect ]
+    ^ self retractInterestsForWhich:[:i | i aspect == aspect ]
 ! !
 
 !Object methodsFor:'Compatibility-Dolphin'!