UndefinedObject.st
changeset 20215 1f5ce73a096c
parent 20191 2081cd452152
child 20220 874c664d2cbd
child 20352 e7f38f6ca005
--- a/UndefinedObject.st	Mon Aug 08 13:14:52 2016 +0200
+++ b/UndefinedObject.st	Mon Aug 08 13:16:17 2016 +0200
@@ -38,17 +38,17 @@
 
 documentation
 "
-    there is only one instance of this class: nil, 
+    there is only one instance of this class: nil,
     representing an undefined or otherwise unspecified object.
 
-    All instance variables, array elements and even method/block local 
+    All instance variables, array elements and even method/block local
     variables are initially set to nil.
 
-    Since in Smalltalk/X (and in other smalltalks), nil is represented by 
-    a special pointer value (NULL), there can be only one instance of UndefinedObject, 
-    and no subclassing is possible. 
-    (to be exact: subclassing UndefinedObject is technically possible, 
-     but instances of it would not be recognized as being nil 
+    Since in Smalltalk/X (and in other smalltalks), nil is represented by
+    a special pointer value (NULL), there can be only one instance of UndefinedObject,
+    and no subclassing is possible.
+    (to be exact: subclassing UndefinedObject is technically possible,
+     but instances of it would not be recognized as being nil
      - therefore, subclassing is blocked and an error is raised when it is tried)
 
     For advanced users:
@@ -114,7 +114,7 @@
 !UndefinedObject class methodsFor:'queries'!
 
 canBeSubclassed
-    "return true, if its allowed to create subclasses of the receiver.
+    "return true if it is allowed to create subclasses of the receiver.
      Return false here - since it is NOT possible for UndefinedObject.
      (due to the representation of nil as a 0-pointer)"
 
@@ -145,13 +145,12 @@
 !
 
 isBuiltInClass
-    "return true, if this class is known by the run-time-system,
+    "return true if this class is known by the run-time-system,
      i.e. you cannot add/remove instance variables without recompiling
      the VM.
      Here, true is returned for myself, false for subclasses."
 
     ^ self == UndefinedObject
-
 ! !
 
 
@@ -296,7 +295,7 @@
 size
     "return the number of indexed instvars
      defined here since size in Object ommits the nil-check"
- 
+
     ^ 0
 ! !
 
@@ -305,9 +304,9 @@
 
 nilSubclass:action
     "common helper for subclass creation.
-     Creates a nil-superclass class. 
+     Creates a nil-superclass class.
      If the CreateMinimumProtocolInNewSubclassQuery answers true,
-     entries for the minimum required protocol (#class, #isBehavior 
+     entries for the minimum required protocol (#class, #isBehavior
      and #doesNotUnderstand:) are also automatically created.
      (this query is typically answered by the browser)
      These are required to avoid getting into deep trouble when
@@ -363,28 +362,28 @@
 !
 
 subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool
-    "create a new class which has nil as superclass 
+    "create a new class which has nil as superclass
      - i.e. traps into #doesNotUnderstand: for all of its messages."
 
     "this method allows fileIn of ST/V and V'Age classes
      (which seem to have no category)"
 
-    ^ self 
-        subclass:nameSymbol 
-        instanceVariableNames:instVarNameString 
-        classVariableNames:classVarString 
+    ^ self
+        subclass:nameSymbol
+        instanceVariableNames:instVarNameString
+        classVariableNames:classVarString
         poolDictionaries:pool
         category:(Class defaultCategoryForSTVorVAGEClasses).
 !
 
 subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
-    "create a new class which has nil as superclass 
+    "create a new class which has nil as superclass
      - i.e. traps into #doesNotUnderstand: for all of its messages."
 
-    ^ self 
+    ^ self
         nilSubclass:[
                 Object class
-                    name:nameSymbol  
+                    name:nameSymbol
                     inEnvironment:(Class nameSpaceQuerySignal query)
                     subclassOf:self
                     instanceVariableNames:instVarNameString
@@ -403,10 +402,10 @@
 !
 
 variableByteSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
-    "create a new class which has nil as superclass 
+    "create a new class which has nil as superclass
      - i.e. traps into #doesNotUnderstand: for all of its messages."
 
-    ^ self 
+    ^ self
         nilSubclass:[
                 Object class
                     name:nameSymbol  
@@ -428,13 +427,13 @@
 !
 
 variableSubclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool category:cat
-    "create a new class which has nil as superclass 
+    "create a new class which has nil as superclass
      - i.e. traps into #doesNotUnderstand: for all of its messages."
 
-    ^ self 
+    ^ self
         nilSubclass:[
                 Object class
-                    name:nameSymbol  
+                    name:nameSymbol
                     inEnvironment:(Class nameSpaceQuerySignal query)
                     subclassOf:self
                     instanceVariableNames:instVarNameString
@@ -455,7 +454,7 @@
 !UndefinedObject methodsFor:'subclass creation-private'!
 
 subclass:nameSymbol instanceVariableNames:instVarNameString classVariableNames:classVarString poolDictionaries:pool privateIn:ownerClassArg
-    "create a new private class which has nil as superclass 
+    "create a new private class which has nil as superclass
      - i.e. traps into #doesNotUnderstand: for all of its messages."
 
     |category ownerClass|
@@ -465,11 +464,11 @@
     ] ifFalse:[
         category := ownerClassArg category
     ].
-    
-    ^ self 
+
+    ^ self
         nilSubclass:[
                 Object class
-                    name:nameSymbol  
+                    name:nameSymbol
                     inEnvironment:ownerClass
                     subclassOf:self
                     instanceVariableNames:instVarNameString
@@ -494,7 +493,7 @@
       if the receiver is nil, return the defaultValue;
       otherwise, return the receiver.
       This method is redefined from Object;
-      the argument is retuned unconditionally here.
+      the argument is returned unconditionally here.
 
       Thus, if foo and bar are simple variables or constants,
           foo ? bar
@@ -566,9 +565,9 @@
 
     "
      1 ?? #default
-     nil ?? #default 
-     1 ?? [Date today]   
-     nil ?? [Date today]  
+     nil ?? #default
+     1 ?? [Date today]
+     nil ?? [Date today]
     "
 
     "Created: / 4.11.1996 / 20:37:09 / cg"
@@ -648,7 +647,7 @@
 !
 
 isEmptyOrNil
-    "return true if I am nil or an empty collection 
+    "return true if I am nil or an empty collection
      - since I am nil, return true. (from Sqeak)"
 
     ^ true
@@ -658,14 +657,14 @@
 !
 
 isLiteral
-    "return true, if the receiver can be used as a literal constant in ST syntax
+    "return true if the receiver can be used as a literal constant in ST syntax
      (i.e. can be used in constant arrays)"
 
     ^ true
 !
 
 isNil
-    "Return true, if the receiver is nil.
+    "Return true if the receiver is nil.
      Since I am definitely nil, unconditionally return true here.
      Notice:
         This method is open coded (inlined) by the compiler(s)
@@ -686,10 +685,13 @@
 !
 
 isNotNil
-    "Return true, if the receiver not nil.
-     Since I am definitely nil, unconditionally return false here.      
+    <resource: #obsolete>
+
+    "Return true if the receiver is not nil.
+     Since I am definitely nil, unconditionally return false here.
      the receiver is definitely not nil here, so unconditionally return false."
 
+    self obsoleteMethodWarning:'use #notNil'.
     ^ false
 
     "Created: / 26-10-2014 / 01:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -703,7 +705,7 @@
 !
 
 notNil
-    "Return true, if the receiver is not nil.
+    "Return true if the receiver is not nil.
      Since I am definitely nil, unconditionally return false here.
      Notice:
         This method is open coded (inlined) by the compiler(s)