author | Claus Gittinger <cg@exept.de> |
Sat, 09 Dec 1995 23:10:33 +0100 | |
changeset 163 | 9a7dfd547e69 |
parent 146 | 3d407ab8ac44 |
child 263 | 3b21d0991eff |
permissions | -rw-r--r-- |
2 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
49 | 3 |
All Rights Reserved |
2 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
141 | 13 |
Parser subclass:#Explainer |
14 |
instanceVariableNames:'' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'System-Compiler' |
|
2 | 18 |
! |
19 |
||
20 |
!Explainer class methodsFor:'documentation'! |
|
21 |
||
20 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
49 | 25 |
All Rights Reserved |
20 | 26 |
|
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
35 |
||
2 | 36 |
documentation |
37 |
" |
|
20 | 38 |
a very simple explainer - much more should be added ... |
39 |
This one is involved, when the 'explain' function is used in a |
|
84 | 40 |
codeView (popup or via CMD-E). |
2 | 41 |
" |
42 |
! ! |
|
43 |
||
44 |
!Explainer class methodsFor:'explaining'! |
|
45 |
||
141 | 46 |
commonSuperClassOf:listOfClassNames |
47 |
|common found| |
|
48 |
||
49 |
listOfClassNames do:[:className | |
|
50 |
|class| |
|
51 |
||
52 |
((className endsWith:'class') and:[className ~= 'Metaclass']) ifTrue:[ |
|
53 |
class := (Smalltalk at:(className copyWithoutLast:5 "copyTo:(className size - 5)") asSymbol) class |
|
54 |
] ifFalse:[ |
|
55 |
class := Smalltalk at:(className asSymbol). |
|
56 |
]. |
|
57 |
common isNil ifTrue:[ |
|
58 |
common := class |
|
59 |
] ifFalse:[ |
|
60 |
(class isSubclassOf:common) ifTrue:[ |
|
61 |
"keep common" |
|
62 |
] ifFalse:[ |
|
63 |
(common isSubclassOf:class) ifTrue:[ |
|
64 |
common := class |
|
65 |
] ifFalse:[ |
|
66 |
"walk up, checking" |
|
67 |
found := false. |
|
68 |
common allSuperclassesDo:[:sup | |
|
69 |
(class isSubclassOf:sup) ifTrue:[ |
|
70 |
common := sup |
|
71 |
] |
|
72 |
]. |
|
73 |
found ifFalse:[ |
|
74 |
class allSuperclassesDo:[:sup | |
|
75 |
(common isSubclassOf:sup) ifTrue:[ |
|
76 |
common := sup |
|
77 |
] |
|
78 |
]. |
|
79 |
]. |
|
80 |
] |
|
81 |
]. |
|
82 |
]. |
|
83 |
common == Object ifTrue:[^ common] |
|
84 |
]. |
|
85 |
^ common |
|
86 |
! |
|
87 |
||
2 | 88 |
explain:someText in:source forClass:aClass |
6 | 89 |
"Given a source and a substring of it, return a string containing |
90 |
an explanation. |
|
49 | 91 |
This is just a q&d implementation - to be correct, it should use the parser, |
92 |
and explain from the parsetree (instead of doing string matches). |
|
93 |
This leads to some wrong explanations, for example if some string is |
|
94 |
used as selector within a string. |
|
95 |
Also, there could be much more detailed explanations." |
|
2 | 96 |
|
97 |
|parser variables v c string sym list count tmp |
|
98 |
commonSuperClass| |
|
99 |
||
100 |
string := someText withoutSeparators. |
|
49 | 101 |
|
102 |
" |
|
103 |
ask parser for variable names |
|
104 |
" |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
105 |
parser := self parseMethod:source in:aClass ignoreErrors:true ignoreWarnings:true. |
2 | 106 |
parser notNil ifTrue:[ |
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
107 |
"look for variables" |
2 | 108 |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
109 |
variables := parser methodVars. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
110 |
(variables notNil and:[variables includes:string]) ifTrue:[ |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
111 |
^ string , ' is a method variable' |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
112 |
]. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
113 |
variables := parser methodArgs. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
114 |
(variables notNil and:[variables includes:string]) ifTrue:[ |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
115 |
^ string , ' is a method argument' |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
116 |
] |
2 | 117 |
]. |
49 | 118 |
|
2 | 119 |
parser isNil ifTrue:[ |
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
120 |
parser := self for:(ReadStream on:source) in:aClass |
2 | 121 |
]. |
122 |
||
123 |
"instvars" |
|
84 | 124 |
c := aClass whichClassDefinesInstVar:string. |
125 |
c notNil ifTrue:[ |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
126 |
^ string , ' is an instance variable in ' , c name |
2 | 127 |
]. |
128 |
||
84 | 129 |
"/ variables := aClass allInstVarNames. |
130 |
"/ (variables notNil and:[variables includes:string]) ifTrue:[ |
|
131 |
"/ "where is it" |
|
132 |
"/ c := aClass. |
|
133 |
"/ [c notNil] whileTrue:[ |
|
134 |
"/ v := c instVarNames. |
|
135 |
"/ (v notNil and:[v includes:string]) ifTrue:[ |
|
136 |
"/ ^ string , ' is an instance variable in ' , c name |
|
137 |
"/ ]. |
|
138 |
"/ c := c superclass |
|
139 |
"/ ]. |
|
140 |
"/ self error:'oops' |
|
141 |
"/ ]. |
|
142 |
||
2 | 143 |
"class instvars" |
144 |
variables := aClass class allInstVarNames. |
|
145 |
(variables notNil and:[variables includes:string]) ifTrue:[ |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
146 |
"where is it" |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
147 |
c := aClass. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
148 |
[c notNil] whileTrue:[ |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
149 |
v := c class instVarNames. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
150 |
(v notNil and:[v includes:string]) ifTrue:[ |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
151 |
^ string , ' is a class instance variable in ' , c name |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
152 |
]. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
153 |
c := c superclass |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
154 |
]. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
155 |
self error:'oops' |
2 | 156 |
]. |
157 |
||
158 |
"classvars" |
|
159 |
c := parser inWhichClassIsClassVar:string. |
|
160 |
c notNil ifTrue:[ |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
161 |
^ string , ' is a class variable in ' , c name |
2 | 162 |
]. |
163 |
||
164 |
string knownAsSymbol ifTrue:[ |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
165 |
"globals & symbols" |
2 | 166 |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
167 |
tmp := self explainKnownSymbol:string. |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
168 |
tmp notNil ifTrue:[ ^ tmp]. |
2 | 169 |
]. |
170 |
||
171 |
"try for some obvious things" |
|
172 |
tmp := self explainPseudoVariable:string in:aClass. |
|
173 |
tmp notNil ifTrue:[ ^ tmp]. |
|
174 |
||
175 |
"try syntax ..." |
|
176 |
||
49 | 177 |
tmp := self explainSyntax:string. |
178 |
tmp notNil ifTrue:[ ^ tmp]. |
|
20 | 179 |
|
2 | 180 |
parser isNil ifTrue:[ |
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
181 |
^ 'parse error - no explanation' |
2 | 182 |
]. |
183 |
^ 'cannot explain this - select individual tokens for an explanation.' |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
184 |
|
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
185 |
"Created: 3.12.1995 / 12:47:37 / cg" |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
186 |
"Modified: 3.12.1995 / 12:48:59 / cg" |
2 | 187 |
! |
188 |
||
141 | 189 |
explainHereIn:aClass |
190 |
^ 'like self, here refers to the object which received the message. |
|
191 |
||
192 |
However, when sending a message to here the search for methods |
|
193 |
implementing this message will start in the defining class (' , aClass name , ') |
|
194 |
instead of the receivers class (' , aClass name , ' or subclass). |
|
195 |
Thus, using here, redefined methods will NOT be reached with a here-send.' |
|
196 |
! |
|
197 |
||
198 |
explainKnownSymbol:string |
|
199 |
"return explanation or nil" |
|
200 |
||
201 |
|sym list count tmp commonSuperClass val| |
|
202 |
||
203 |
sym := string asSymbol. |
|
204 |
||
205 |
"try globals" |
|
206 |
||
207 |
(Smalltalk includesKey:sym) ifTrue:[ |
|
208 |
tmp := string , ' is a global variable.'. |
|
209 |
val := Smalltalk at:sym. |
|
210 |
val isBehavior ifTrue:[ |
|
211 |
val name = string ifTrue:[ |
|
212 |
tmp := tmp , ' |
|
213 |
||
214 |
' , string , ' is a class categorized as ' , val category , ' |
|
215 |
in the ''' , val package , ''' package.' |
|
216 |
] ifFalse:[ |
|
217 |
tmp := tmp , ' |
|
218 |
||
219 |
' , string , ' is bound to the class ' , val name , |
|
220 |
' in category ' , val category , '.' |
|
221 |
] |
|
222 |
] ifFalse:[ |
|
223 |
tmp := tmp , ' |
|
224 |
||
225 |
Its current value is ' , val classNameWithArticle , '.' |
|
226 |
]. |
|
227 |
^ tmp. |
|
228 |
]. |
|
229 |
||
230 |
" |
|
231 |
try selectors |
|
232 |
look who implements it |
|
233 |
" |
|
234 |
list := Set new. |
|
235 |
Smalltalk allBehaviorsDo:[:c| |
|
236 |
(c implements:sym) ifTrue:[ |
|
237 |
list add:(c name) |
|
238 |
]. |
|
239 |
(c class implements:sym) ifTrue:[ |
|
240 |
list add:(c name , 'class') |
|
241 |
] |
|
242 |
]. |
|
243 |
||
244 |
count := list size. |
|
245 |
(count ~~ 0) ifTrue:[ |
|
246 |
" |
|
247 |
for up-to 4 implementing classes, |
|
248 |
list them |
|
249 |
" |
|
250 |
list := list asOrderedCollection sort. |
|
251 |
tmp := ' is a selector implemented in '. |
|
252 |
(count == 1) ifTrue:[ |
|
253 |
^ string , tmp , (list at:1) , '.' |
|
254 |
]. |
|
255 |
||
256 |
(count == 2) ifTrue:[ |
|
257 |
^ string , tmp , (list at:1) , ' and ' , (list at:2) , '.' |
|
258 |
]. |
|
259 |
(count == 3) ifTrue:[ |
|
260 |
^ string , tmp , ' |
|
261 |
' , (list at:1) , ', ' , (list at:2) , ' and ' , (list at:3) , '.' |
|
262 |
]. |
|
263 |
(count == 4) ifTrue:[ |
|
264 |
^ string , tmp , ' |
|
265 |
' , (list at:1) , ', ' , (list at:2) , ', ' , (list at:3), ' and ' , (list at:4) , '.' |
|
266 |
]. |
|
267 |
||
268 |
" |
|
269 |
if there are more, look for a common |
|
270 |
superclass and show it ... |
|
271 |
" |
|
272 |
commonSuperClass := self commonSuperClassOf:list. |
|
273 |
commonSuperClass ~~ Object ifTrue:[ |
|
274 |
(list includes:commonSuperClass) ifTrue:[ |
|
275 |
^ string , tmp, count printString , commonSuperClass name |
|
276 |
, ' and redefined in ' , (count - 1) printString |
|
277 |
, ' subclasses' |
|
278 |
]. |
|
279 |
^ string , tmp, count printString , ' subclasses of ' , commonSuperClass name |
|
280 |
]. |
|
281 |
||
282 |
" |
|
283 |
otherwise just give the number. |
|
284 |
" |
|
285 |
^ string , tmp , count printString , ' classes.' |
|
286 |
]. |
|
287 |
||
288 |
^ nil |
|
289 |
! |
|
290 |
||
2 | 291 |
explainPseudoVariable:string in:aClass |
292 |
"return explanation for the pseudoVariables self, super etc." |
|
293 |
||
294 |
(string = 'self') ifTrue:[ |
|
49 | 295 |
^ self explainSelfIn:aClass |
2 | 296 |
]. |
297 |
||
298 |
(string = 'super') ifTrue:[ |
|
49 | 299 |
^ self explainSuperIn:aClass |
2 | 300 |
]. |
301 |
||
84 | 302 |
(string = 'here') ifTrue:[ |
303 |
^ self explainHereIn:aClass |
|
304 |
]. |
|
305 |
||
2 | 306 |
(string = 'thisContext') ifTrue:[ |
49 | 307 |
^ 'thisContext is a pseudo variable (i.e. it is built in). |
2 | 308 |
|
49 | 309 |
ThisContext always refers to the context object for the currently executed method or |
310 |
block (an instance of Context or BlockContext respectively). The calling chain and calling |
|
6 | 311 |
receivers/selectors can be accessed via thisContext.' |
312 |
]. |
|
313 |
||
314 |
(string = 'true') ifTrue:[ |
|
49 | 315 |
^ 'true is a pseudo variable (i.e. it is built in). |
6 | 316 |
|
317 |
True represents logical truth. It is the one and only instance of class True.' |
|
2 | 318 |
]. |
319 |
||
320 |
(string = 'false') ifTrue:[ |
|
49 | 321 |
^ 'false is a pseudo variable (i.e. it is built in). |
2 | 322 |
|
323 |
False represents logical falseness. It is the one and only instance of class False.' |
|
324 |
]. |
|
325 |
||
326 |
(string = 'nil') ifTrue:[ |
|
49 | 327 |
^ 'nil is a pseudo variable (i.e. it is built in). |
2 | 328 |
|
329 |
Nil is used for unitialized variables (among other uses). |
|
330 |
Nil is the one and only instance of class UndefinedObject.' |
|
331 |
]. |
|
332 |
^ nil |
|
333 |
! |
|
334 |
||
6 | 335 |
explainSelfIn:aClass |
336 |
|sub| |
|
337 |
||
338 |
sub := aClass allSubclasses collect:[:c | c name]. |
|
339 |
sub size == 0 ifTrue:[ |
|
49 | 340 |
^ 'self refers to the object which received the message. |
6 | 341 |
|
342 |
In this case, it will be an instance of ' , aClass name , '.' |
|
343 |
]. |
|
344 |
||
345 |
sub size <= 5 ifTrue:[ |
|
49 | 346 |
^ 'self refers to the object which received the message. |
6 | 347 |
|
348 |
In this case, it will be an instance of ' , aClass name , ' |
|
349 |
or one of its subclasses: |
|
350 |
||
58 | 351 |
' , sub asStringCollection asString |
6 | 352 |
]. |
353 |
||
354 |
^ 'self refers to the object which received the message. |
|
355 |
||
356 |
In this case, it will be an instance of ' , aClass name , ' |
|
357 |
or one of its ' , sub size printString , ' subclasses.' |
|
358 |
! |
|
359 |
||
360 |
explainSuperIn:aClass |
|
361 |
^ 'like self, super refers to the object which received the message. |
|
362 |
||
363 |
However, when sending a message to super the search for methods |
|
364 |
implementing this message will start in the superclass (' , aClass superclass name , ') |
|
84 | 365 |
instead of the receivers class (' , aClass name , ' or subclass). |
49 | 366 |
Thus, using super, a redefined method can call the original method in its superclass.' |
6 | 367 |
! |
2 | 368 |
|
49 | 369 |
explainSyntax:string |
370 |
"try syntax ...; return explanation or nil" |
|
371 |
||
372 |
((string = ':=') or:[string = '_']) ifTrue:[ |
|
373 |
^ '<variable> := <expression> |
|
374 |
||
375 |
:= and _ (which is left-arrow in some fonts) mean assignment. |
|
376 |
The variable is bound to (i.e. points to) the value of <expression>.' |
|
377 |
]. |
|
378 |
||
379 |
(string = '^') ifTrue:[ |
|
380 |
^ '^ <expression> |
|
381 |
||
382 |
return the value of <expression> as value from the method. |
|
383 |
A return from within a block exits the method where the block is defined.' |
|
384 |
]. |
|
385 |
||
386 |
(string = ';') ifTrue:[ |
|
387 |
^ '<expression> ; selector1 ; .... ; selectorN |
|
388 |
||
389 |
a cascade expression; evaluate expression, and send messages |
|
390 |
<selector1> ... <selectorN> to the first expressions receiver. |
|
391 |
Returns the value of the last send. The cascade sends may also have arguments.' |
|
392 |
]. |
|
393 |
||
394 |
(string = '|') ifTrue:[ |
|
395 |
^ '| locals | or: [:arg | statements] |
|
396 |
||
397 |
| is used to mark a local variable declaration or separates arguments |
|
398 |
from the statements in a block. Notice, that in a block-argument declaration |
|
399 |
these must be prefixed by a colon character. |
|
400 |
| is also a selector understood by Booleans.' |
|
401 |
]. |
|
402 |
||
403 |
((string startsWith:'(') or:[string endsWith:')']) ifTrue:[ |
|
404 |
^ '(<expression>) |
|
405 |
||
406 |
expression grouping.' |
|
407 |
]. |
|
408 |
||
409 |
((string startsWith:'[') or:[string endsWith:']']) ifTrue:[ |
|
410 |
^ '[arguments | statements] |
|
411 |
||
412 |
defines a block. |
|
413 |
Blocks represent pieces of executable code. Definition of a block does |
|
414 |
not evaluate it. The block is evaluated by sending it a value/value: |
|
415 |
message. |
|
416 |
Blocks are often passed as arguments to Booleans (i.e. ifTrue:[...]) or |
|
417 |
collections (i.e. do:[...]).' |
|
418 |
]. |
|
419 |
||
420 |
(string = ':') ifTrue:[ |
|
421 |
^ 'colons have different meaning depending on context: |
|
422 |
||
423 |
1) they separate keyword-parts in symbols and keyword-messages as in: |
|
424 |
||
425 |
#at:put: a constant keyword symbol |
|
426 |
||
427 |
rec at:index put:value sends the #at:put: message to rec, |
|
428 |
passing index and value as arguments. |
|
429 |
||
430 |
2) within block-argument declarations as in: |
|
431 |
||
432 |
[:arg1 :arg2 | statements] |
|
433 |
' |
|
434 |
]. |
|
435 |
||
436 |
(string = '.') ifTrue:[ |
|
437 |
^ 'statement. "<- period here" |
|
438 |
statement |
|
439 |
||
440 |
within a method or block, individual statements are separated by periods. |
|
441 |
' |
|
442 |
]. |
|
443 |
||
444 |
(string startsWith:'#' ) ifTrue:[ |
|
445 |
(string startsWith:'#(' ) ifTrue:[ |
|
446 |
^ 'is a constant Array. |
|
447 |
||
448 |
The elements of a constant Array must be Number-constants, nil, true or false. |
|
449 |
(notice, that not all Smalltalk implementations allow true, false and nil as |
|
450 |
constant-Array elements).' |
|
451 |
]. |
|
452 |
||
453 |
(string startsWith:'#[') ifTrue:[ |
|
454 |
^ 'is a constant ByteArray. |
|
455 |
||
456 |
The elements of a constant ByteArray must be Integer constants in the range |
|
457 |
0 .. 255. |
|
458 |
(notice, that not all Smalltalk implementations support constant ByteArrays).' |
|
459 |
]. |
|
460 |
||
461 |
(string startsWith:'#''') ifTrue:[ |
|
462 |
^ 'is a constant symbol containing non-alphanumeric characters. |
|
463 |
||
464 |
Symbols are unique strings, meaning that there exists |
|
465 |
exactly one instance of a given symbol. Therefore symbols can |
|
466 |
be compared using == (identity compare) in addition to = (contents compare). |
|
467 |
Beside this, Symbols behave mostly like Strings. |
|
468 |
||
469 |
Notice, that not all Smalltalk implementations support this kind of symbols.' |
|
470 |
]. |
|
471 |
||
472 |
^ 'is a symbol. |
|
473 |
||
474 |
Symbols are unique strings, meaning that there exists |
|
475 |
exactly one instance of a given symbol. Therefore symbols can |
|
476 |
be compared using == (identity compare) in addition to = (contents compare). |
|
477 |
Beside this, Symbols behave mostly like Strings.' |
|
478 |
]. |
|
479 |
||
480 |
"/ is it a symbol without hash-character ? |
|
481 |
"/ |
|
482 |
string knownAsSymbol ifTrue:[ |
|
483 |
^ 'is nothing, but #' , string , ' is known as a symbol. |
|
484 |
||
485 |
Symbols are unique strings, meaning that there exists |
|
486 |
exactly one instance of a given symbol. Therefore symbols can |
|
487 |
be compared using == (identity compare) in addition to = (contents compare). |
|
488 |
Beside this, Symbols behave mostly like Strings.' |
|
489 |
]. |
|
490 |
||
491 |
^ nil |
|
141 | 492 |
! ! |
49 | 493 |
|
146
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
494 |
!Explainer class methodsFor:'documentation'! |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
495 |
|
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
496 |
version |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
497 |
^ '$Header: /cvs/stx/stx/libcomp/Explainer.st,v 1.16 1995-12-03 11:49:46 cg Exp $' |
3d407ab8ac44
suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents:
141
diff
changeset
|
498 |
! ! |