Object.st
changeset 859 a532cd2450dd
parent 829 fc386319f41c
child 861 2b4dc0a4f65a
--- a/Object.st	Sun Jan 14 17:28:48 1996 +0100
+++ b/Object.st	Mon Jan 15 13:20:09 1996 +0100
@@ -3884,35 +3884,60 @@
 
 become:anotherObject
     "make all references to the receiver become references to anotherObject
-     and vice-versa. This may be an expensive (i.e. slow) operation, 
+     and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become.
+     This can be a very dangerous operation - be warned.
+
+     This may be an expensive (i.e. slow) operation, 
      since in the worst case, the whole memory has to be searched for 
      references to the two objects (although the primitive tries hard to
      limit the search, for acceptable performance in most cases). 
-     In general, using become: should be avoided if possible, since it may 
+     In general, using #become: should be avoided if possible, since it may 
      produce many strange effects (think of hashing in Sets).
      This method fails, if the receiver or the argument is a SmallInteger 
      or nil, or is a context of a living method (i.e. one that has not already 
      returned).
-     (notice that become: is not used heavily by the system 
+     (notice that #become: is not used heavily by the system 
       - the Collection-classes have been rewritten to not use it.)"
 %{
-    if (__primBecome(self, anotherObject COMMA_CON))
+    if (__primBecome(self, anotherObject COMMA_CON)) {
 	RETURN ( self );
-%}
-.
+    }
+%}.
     self primitiveFailed
 !
 
 becomeNil
     "make all references to the receiver become nil - effectively getting
-     rid of the receiver. This can be a very dangerous operation - be warned.
+     rid of the receiver. 
+     This can be a very dangerous operation - be warned.
+
+     This may be an expensive (i.e. slow) operation.
      The receiver may not be a SmallInteger or a context of a living method."
 
 %{
-    if (__primBecomeNil(self COMMA_CON ))
+    if (__primBecomeNil(self COMMA_CON )) {
 	RETURN ( nil );
-%}
-.
+    }
+%}.
+    self primitiveFailed
+!
+
+becomeSameAs:anotherObject
+    "make all references to the receiver become references to anotherObject
+     but NOT vice versa (as done in #become).
+     This can be a very dangerous operation - be warned.
+
+     This may be an expensive (i.e. slow) operation,
+     since in the worst case, the whole memory has to be searched for
+     references to the two objects (although the primitive tries hard to
+     limit the search, for acceptable performance in most cases).
+     This method fails, if the receiver or the argument is a SmallInteger
+     or nil, or is a context of a living method (i.e. one that has not already returned)."
+%{
+    if (__primBecomeSameAs(self, anotherObject COMMA_CON)) {
+	RETURN ( self );
+    }
+%}.
     self primitiveFailed
 !
 
@@ -4186,6 +4211,6 @@
 !Object class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.83 1996-01-04 01:23:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.84 1996-01-15 12:20:09 cg Exp $'
 ! !
 Object initialize!