Object.st
changeset 1327 5dd6b52d8325
parent 1294 e26bbb61f6b2
child 1345 2a7936bdc81a
--- a/Object.st	Thu May 02 17:21:19 1996 +0200
+++ b/Object.st	Fri May 03 11:58:11 1996 +0200
@@ -1914,7 +1914,8 @@
      #doesNotUnderstand: message.
      Here, we raise another signal which usually enters the debugger.
      You can of course redefine #doesNotUnderstand: in your classes
-     to implement message delegation."
+     to implement message delegation, 
+     or handle the MessageNotUnderstoodSignal gracefully."
 
     |sel errorString cls sender|
 
@@ -1922,17 +1923,17 @@
     "/ (output streams not yet initialized)
     "/
     Stdout isNil ifTrue:[
-	Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
+        Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
     ].
 
     (sel := aMessage selector) isNil ifTrue:[
-	"/
-	"/ happens when things go mad, or a method has been
-	"/ called by valueWithReceiver: with a wrong receiver
-	"/ to avoud later trouble (when concatenating strings),
-	"/ replace the selector by some (nonNil) string
-	"/
-	sel := '(nil)'
+        "/
+        "/ happens when things go mad, or a method has been
+        "/ called by valueWithReceiver: with a wrong receiver.
+        "/ To avoid later trouble (when concatenating strings),
+        "/ replace the selector by some (nonNil) string
+        "/
+        sel := '(nil)'
     ].
 
     "/
@@ -1942,41 +1943,41 @@
     sender := thisContext sender.
     cls := sender searchClass.
     cls isNil ifTrue:[
-	"it was NOT a super or directed send ..."
-	cls := self class
+        "it was NOT a super or directed send ..."
+        cls := self class
     ].
 
     cls notNil ifTrue:[
-	"/
-	"/ displayString is better than 'cls name',
-	"/ since it appends (obsolete) for outdated classes.
-	"/ (this happens if you send messages to old instances
-	"/  after changing a classes definition)
-	"/
-	errorString := cls displayString.
+        "/
+        "/ displayString is better than 'cls name',
+        "/ since it appends (obsolete) for outdated classes.
+        "/ (this happens if you send messages to old instances
+        "/  after changing a classes definition)
+        "/
+        errorString := cls displayString.
     ] ifFalse:[    
-	errorString := '(** nil-class **)'
+        errorString := '(** nil-class **)'
     ].
     errorString := errorString , ' does not understand: ' , sel.
 
     "/
     "/ this only happens, when YOU play around with my classvars ...
-    "/ (or an error occurs during early startup, when signals are not yet set)
+    "/ (or an error occurs during very early startup, when signals are not yet set)
     "/
     MessageNotUnderstoodSignal isNil ifTrue:[
-	^ self enterDebuggerWith:nil
-			 message:'oops - MessageNotUnderstoodSignal is gone'.
+        ^ self enterDebuggerWith:nil
+                         message:'oops - MessageNotUnderstoodSignal is gone'.
     ].
 
     "/
     "/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger
     "/
     ^ MessageNotUnderstoodSignal
-		raiseRequestWith:aMessage
-		     errorString:errorString
-			      in:sender
-
-    "Modified: 9.12.1995 / 17:25:37 / cg"
+                raiseRequestWith:aMessage
+                     errorString:errorString
+                              in:sender
+
+    "Modified: 3.5.1996 / 11:51:45 / cg"
 !
 
 elementBoundsError
@@ -2229,17 +2230,33 @@
 !Object methodsFor:'evaluation'!
 
 value
-    "this allows every object to be used where blocks are typically used.
+    "return the receiver itself.
+     This allows every object to be used where blocks or valueHolders
+     are typically used, and allows for valueHolders and blocks to be
+     used interchangably in some situations.
+
      Time will show, if this is a good idea or leads to sloppy programming
      style ... (the idea was borrowed from the Self language).
-     WARNING: dont 'optimize' away ifXXX: blocks - the compilers will 
-	      only generate inline code for the if, if the argument(s) are blocks.
-	      It will work, but run slower instead."
+
+     WARNING: dont 'optimize' away ifXXX: blocks 
+              (i.e. do NOT replace 
+                        foo ifTrue:[var1] ifFalse:[var2]
+               by:
+                        foo ifTrue:var1 ifFalse:var2
+              )
+              - the compilers will only generate inline code for the if, 
+                iff the argument(s) are blocks - otherwise, a true send is
+                generated.
+              This 'oprimization' will work semantically correct,
+              but execute SLOWER instead."
 
     ^ self
 
     "
-     #(1 2 3 4) indexOf:5 ifAbsent:0 
+     #(1 2 3 4) indexOf:5 ifAbsent:0     
+     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
+     1 > 2 ifTrue:['yes'] ifFalse:['no']  
+     1 > 2 ifTrue:'yes' ifFalse:'no'       
     "
 
     "DO NOT DO THIS (its slower)
@@ -2248,6 +2265,8 @@
      USE (the compiler optimizes blocks in if/while):
      (1 > 4) ifTrue:['oops'] ifFalse:['ok']
     "
+
+    "Modified: 3.5.1996 / 11:57:08 / cg"
 ! !
 
 !Object methodsFor:'initialization'!
@@ -4965,6 +4984,6 @@
 !Object class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.114 1996-04-25 16:52:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.115 1996-05-03 09:58:11 cg Exp $'
 ! !
 Object initialize!