UndefinedObject.st
author Stefan Vogel <sv@exept.de>
Thu, 13 Jun 1996 00:11:10 +0200
changeset 1461 dd25bb1e9973
parent 1303 8fdc2c653d13
child 1638 8df0060e4d73
permissions -rw-r--r--
Use methodDictionary instead of selector/method arrays. Still backward compatible if UseMethodDictionary in Behavior is set to false.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 95
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
    13
'From Smalltalk/X, Version:2.10.9 on 12-jun-1996 at 11:56:25'                   !
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
    14
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    15
Object subclass:#UndefinedObject
1029
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
    16
	instanceVariableNames:''
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
    17
	classVariableNames:''
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
    18
	poolDictionaries:''
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
    19
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    22
!UndefinedObject class methodsFor:'documentation'!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    23
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    24
copyright
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    25
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    26
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 95
diff changeset
    27
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    28
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    29
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    30
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    32
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    33
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    34
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    35
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    36
!
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    37
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    38
documentation
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    39
"
1303
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    40
    there is only one instance of this class: nil, 
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    41
    representing an undefined or otherwise unspecified object.
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    42
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    43
    All instance variables, array elements and even method/block local 
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    44
    variables are initially set to nil.
1303
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    45
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    46
    Since in Smalltalk/X, nil is represented by a special pointer value (NULL),
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    47
    there can be only one instance of UndefinedObject, and no subclassing is
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    48
    possible. 
1303
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    49
    (to be exact: subclassing UndefinedObject is technically possible, 
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    50
     but instances of it would not be recognized as being nil 
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    51
     - therefore, subclassing is blocked and an error is raised when it is tried)
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    52
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    53
    For advanced users:
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    54
      Beside the above role, nil can be subclassed (!!).
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    55
      This creates a class which inherits no protocol whatsoever - not even
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    56
      the basic interfaces as defined by the Object class. Subclasses of nil
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    57
      are useful if all messages send to instances should trap into the
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    58
      #doesNotUnderstand: method. For example, proxy objects are typically defined
8fdc2c653d13 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
    59
      this way.
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    60
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    61
    [author:]
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
    62
        Claus Gittinger
88
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    63
"
81dacba7a63a *** empty log message ***
claus
parents: 77
diff changeset
    64
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
a27a279701f8 Initial revision
claus
parents:
diff changeset
    66
!UndefinedObject class methodsFor:'instance creation'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    67
a27a279701f8 Initial revision
claus
parents:
diff changeset
    68
basicNew
a27a279701f8 Initial revision
claus
parents:
diff changeset
    69
    "catch new - there MUST be only one nil in the system"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    70
a27a279701f8 Initial revision
claus
parents:
diff changeset
    71
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
    72
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    73
a27a279701f8 Initial revision
claus
parents:
diff changeset
    74
basicNew:size
a27a279701f8 Initial revision
claus
parents:
diff changeset
    75
    "catch new - there MUST be only one nil in the system"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    76
a27a279701f8 Initial revision
claus
parents:
diff changeset
    77
    ^ nil
a27a279701f8 Initial revision
claus
parents:
diff changeset
    78
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
    79
51
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    80
!UndefinedObject class methodsFor:'queries'!
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    81
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    82
canBeSubclassed
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    83
    "return true, if its allowed to create subclasses of the receiver.
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    84
     Return nil here - since it is NOT possible for UndefinedObject"
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    85
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    86
    ^ false
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    87
! !
9b7ae5e18f3e *** empty log message ***
claus
parents: 41
diff changeset
    88
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    89
!UndefinedObject methodsFor:'copying'!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    90
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    91
copy
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    92
    "return a shallow copy of myself
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    93
     - since there is only one nil in the system return self"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    94
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    95
    ^ self
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    96
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    97
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    98
deepCopy
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
    99
    "return a deep copy of myself
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   100
     - since there is only one nil in the system return self"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   101
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   102
    ^ self
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   103
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   104
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   105
deepCopyUsing:aDictionary
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   106
    "return a deep copy of myself
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   107
     - since there is only one nil in the system return self"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   108
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   109
    ^ self
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   110
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   111
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   112
shallowCopy
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   113
    "return a shallow copy of myself
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   114
     - since there is only one nil in the system return self"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   115
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   116
    ^ self
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   117
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   118
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   119
simpleDeepCopy
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   120
    "return a deep copy of myself
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   121
     - since there is only one nil in the system return self"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   122
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   123
    ^ self
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   124
! !
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   125
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   126
!UndefinedObject methodsFor:'error catching'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   127
a27a279701f8 Initial revision
claus
parents:
diff changeset
   128
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   129
    "catch array access - its illegal
a27a279701f8 Initial revision
claus
parents:
diff changeset
   130
     defined here since basicAt: in Object ommits the nil-check"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   131
a27a279701f8 Initial revision
claus
parents:
diff changeset
   132
    ^ self notIndexed
a27a279701f8 Initial revision
claus
parents:
diff changeset
   133
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
a27a279701f8 Initial revision
claus
parents:
diff changeset
   135
basicAt:index put:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   136
    "catch array access - its illegal
a27a279701f8 Initial revision
claus
parents:
diff changeset
   137
     defined here since basicAt:put: in Object ommits the nil-check"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   138
a27a279701f8 Initial revision
claus
parents:
diff changeset
   139
    ^ self notIndexed
a27a279701f8 Initial revision
claus
parents:
diff changeset
   140
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   141
a27a279701f8 Initial revision
claus
parents:
diff changeset
   142
!UndefinedObject methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   143
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   144
printOn:aStream
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   145
    "append a printed representation of the receiver to the
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   146
     argument, aStream"
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   147
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   148
    aStream nextPutAll:'nil'
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   149
!
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   150
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   151
printString
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   152
    "return a string for printing myself"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   153
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   154
    ^ 'nil'
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   155
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   156
63
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   157
storeOn:aStream
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   158
    "append a printed representation of the receiver to the
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   159
     argument, aStream, which allows reconstruction of it"
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   160
1f0cdefb013f *** empty log message ***
claus
parents: 51
diff changeset
   161
    ^ self printOn:aStream
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   162
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   163
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   164
storeString
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   165
    "return a string for storing myself"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   166
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   167
    ^ 'nil'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   168
! !
2
claus
parents: 1
diff changeset
   169
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   170
!UndefinedObject methodsFor:'subclass creation'!
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   171
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   172
nilSubclass:selector args:args
356
claus
parents: 293
diff changeset
   173
    "common helper for subclass creation.
claus
parents: 293
diff changeset
   174
     Creates a nil-superclass class with entries for the minimum
claus
parents: 293
diff changeset
   175
     required protocol (#class, #isBehavior and #doesNotUnderstand:).
claus
parents: 293
diff changeset
   176
     These are required to avoid getting into deep trouble when
claus
parents: 293
diff changeset
   177
     inspecting or debugging instances of this new class.
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   178
356
claus
parents: 293
diff changeset
   179
     The methods get a modified source code to remind you that these
claus
parents: 293
diff changeset
   180
     methods were automatically generated."
claus
parents: 293
diff changeset
   181
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   182
    |newClass methodDict method|
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   183
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   184
    Class withoutUpdatingChangesDo:[
1029
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   185
        newClass := Object perform:selector withArguments:args
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   186
    ].
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   187
    newClass notNil ifTrue:[
1029
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   188
        newClass setSuperclass:nil.
356
claus
parents: 293
diff changeset
   189
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   190
        newClass methodDictionary size == 0 ifTrue:[
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   191
            "
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   192
             copy over method objects from Object
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   193
             and modify the source code
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   194
            "
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   195
            methodDict := MethodDictionary new:3.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   196
            #(#class #isBehavior #doesNotUnderstand) do:[:sel|
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   197
                method := (Object compiledMethodAt:sel) copy.
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   198
                method source: method source , '
356
claus
parents: 293
diff changeset
   199
"
claus
parents: 293
diff changeset
   200
*** WARNING
claus
parents: 293
diff changeset
   201
***
claus
parents: 293
diff changeset
   202
*** this method has been automatically created,
claus
parents: 293
diff changeset
   203
*** since all nil-subclasses should respond to some minimum required
claus
parents: 293
diff changeset
   204
*** protocol.
claus
parents: 293
diff changeset
   205
***
claus
parents: 293
diff changeset
   206
*** Inspection and/or debugging of instances may not be possible,
claus
parents: 293
diff changeset
   207
*** if you remove/change this method. 
claus
parents: 293
diff changeset
   208
"
claus
parents: 293
diff changeset
   209
'.
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   210
                methodDict at:sel put:method.
1029
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   211
            ].
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   212
            newClass methodDictionary:methodDict.
1029
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   213
            Class addChangeRecordForClass:newClass.
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   214
        ]
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   215
    ].
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   216
    ^ newClass
1029
c469a63e88e2 only redefine #class/#isbehavior/#doesNotUnderstand once (if no methods are present yet)
Claus Gittinger <cg@exept.de>
parents: 695
diff changeset
   217
1030
a21295a6725d oops - the last one did not do it
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   218
    "Modified: 28.2.1996 / 15:47:41 / cg"
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   219
    "Modified: 12.6.1996 / 10:46:15 / stefan"
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   220
!
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   221
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   222
subclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   223
    "create a new class which has nil as superclass 
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   224
     - i.e. traps into doesNotUnderstand: for all of its messages."
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   225
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   226
    ^ self nilSubclass:(thisContext selector) args:(thisContext args)
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   227
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   228
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   229
variableByteSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   230
    "create a new class which has nil as superclass 
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   231
     - i.e. traps into doesNotUnderstand: for all of its messages."
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   232
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   233
    ^ self nilSubclass:(thisContext selector) args:(thisContext args)
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   234
!
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   235
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   236
variableSubclass:t instanceVariableNames:f classVariableNames:d poolDictionaries:s category:cat
159
514c749165c3 *** empty log message ***
claus
parents: 95
diff changeset
   237
    "create a new class which has nil as superclass 
514c749165c3 *** empty log message ***
claus
parents: 95
diff changeset
   238
     - i.e. traps into doesNotUnderstand: for all of its messages."
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   239
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 159
diff changeset
   240
    ^ self nilSubclass:(thisContext selector) args:(thisContext args)
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   241
! !
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   242
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   243
!UndefinedObject methodsFor:'testing'!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   244
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   245
basicSize
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   246
    "return the number of indexed instvars
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   247
     defined here since size in Object ommits the nil-check"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   248
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   249
    ^ 0
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   250
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   251
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   252
hash
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   253
    "return an integer useful as a hash key"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   254
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   255
    ^ 0
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   256
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   257
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   258
identityHash
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   259
    "return an integer useful as a hash key"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   260
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   261
    ^ 0
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   262
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   263
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   264
isLiteral
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   265
    "return true, if the receiver can be used as a literal
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   266
     (i.e. can be used in constant arrays)"
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   267
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   268
    ^ true
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   269
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   270
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   271
isNil
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   272
    "return true if I am nil - since I am, return true"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   273
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   274
    ^ true
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   275
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   276
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   277
notNil
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   278
    "return true if I am not nil - since I am nil, return false"
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   279
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   280
    ^ false
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   281
!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   282
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   283
size
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   284
    "return the number of indexed instvars
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   285
     defined here since size in Object ommits the nil-check"
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   286
 
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   287
    ^ 0
77
6c38ca59927f *** empty log message ***
claus
parents: 63
diff changeset
   288
! !
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   289
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   290
!UndefinedObject class methodsFor:'documentation'!
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   291
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   292
version
1461
dd25bb1e9973 Use methodDictionary instead of selector/method arrays.
Stefan Vogel <sv@exept.de>
parents: 1303
diff changeset
   293
    ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.24 1996-06-12 22:11:08 stefan Exp $'
695
20ec350f92ca checkin from browser
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   294
! !