UndefinedObject.st
changeset 1868 1cd4273ea11b
parent 1803 754f9205b651
child 1958 d8d575552c87
--- a/UndefinedObject.st	Mon Nov 04 20:42:42 1996 +0100
+++ b/UndefinedObject.st	Mon Nov 04 20:43:37 1996 +0100
@@ -241,6 +241,28 @@
 
 !UndefinedObject methodsFor:'testing'!
 
+? defaultValue
+     "if the receiver is nil, return the defaultValue;
+      otherwise, return the receiver.
+      This method is redefined from Object;
+      the argument is retuned unconditionally here.
+
+      Can be used to provide defaultValues to variables,
+      as in:
+        foo := arg ? #defaultValue
+     "
+
+    ^ defaultValue
+
+    "
+     1 ? #default
+     nil ? #default 
+    "
+
+    "Created: 4.11.1996 / 20:37:09 / cg"
+    "Modified: 4.11.1996 / 20:41:53 / cg"
+!
+
 basicSize
     "return the number of indexed instvars
      defined here since size in Object ommits the nil-check"
@@ -289,5 +311,5 @@
 !UndefinedObject class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.26 1996-10-22 19:38:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.27 1996-11-04 19:43:37 cg Exp $'
 ! !