@@ -26,7 +26,7 @@ THE SOFTWARE.
26
26
Object = nil (
27
27
class = primitive
28
28
objectSize = primitive "size in bytes"
29
-
29
+
30
30
"Comparing"
31
31
32
32
" If you override =, you MUST override hashcode as well. The rule
@@ -38,48 +38,49 @@ Object = nil (
38
38
~= other = (^ (self == other) not )
39
39
isNil = ( ^false )
40
40
notNil = ( ^true )
41
-
41
+
42
42
"Converting"
43
43
asString = ( ^'instance of ' + (self class) )
44
44
, element = ( ^(Vector new append: self) append: element )
45
45
hashcode = primitive
46
-
46
+
47
47
"Evaluating"
48
48
value = ( ^self )
49
-
49
+
50
50
"Convenience"
51
51
ifNil: aBlock = (^self)
52
52
ifNotNil: aBlock = (^aBlock value)
53
53
ifNil: noGoBlock ifNotNil: goBlock = (^goBlock value)
54
-
54
+ ifNotNil: goBlock ifNil: noGoBlock = (^goBlock value)
55
+
55
56
"Printing"
56
57
print = ( self asString print )
57
58
println = ( self print. system printNewline )
58
59
59
60
"Debugging"
60
61
inspect = primitive
61
62
halt = primitive
62
-
63
+
63
64
"Error handling"
64
65
error: string = ( '' println. ('ERROR: ' + string) println. system exit: 1 )
65
-
66
+
66
67
"Abstract method support"
67
68
subclassResponsibility = (
68
69
self error: 'This method is abstract and should be overridden'
69
70
)
70
-
71
+
71
72
"Error recovering"
72
73
doesNotUnderstand: selector arguments: arguments = (
73
74
self error:
74
75
('Method ' + selector + ' not found in class ' + self class name)
75
76
)
76
-
77
+
77
78
escapedBlock: block = (
78
79
self error: 'Block has escaped and cannot be executed'
79
80
)
80
-
81
+
81
82
unknownGlobal: name = ( ^system resolve: name )
82
-
83
+
83
84
"Reflection"
84
85
respondsTo: aSymbol = (
85
86
(self class hasMethod: aSymbol)
@@ -92,13 +93,13 @@ Object = nil (
92
93
ifFalse: [ cls := cls superclass ] ].
93
94
^ false ]
94
95
)
95
-
96
+
96
97
perform: aSymbol = primitive
97
98
perform: aSymbol withArguments: args = primitive
98
-
99
+
99
100
perform: aSymbol inSuperclass: cls = primitive
100
101
perform: aSymbol withArguments: args inSuperclass: cls = primitive
101
-
102
+
102
103
instVarAt: idx = primitive
103
104
instVarAt: idx put: obj = primitive
104
105
instVarNamed: sym = primitive
0 commit comments