Explainer.st
author Stefan Vogel <sv@exept.de>
Tue, 26 Nov 2002 17:19:10 +0100
changeset 1352 e9e91394ca1a
parent 1331 0951a2122a85
child 1357 3936e1d64491
permissions -rw-r--r--
Remove unused method variables
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     1
"
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
     3
	      All Rights Reserved
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     4
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    11
"
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    12
1081
6e6255672d68 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    13
"{ Package: 'stx:libcomp' }"
6e6255672d68 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    14
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    15
Parser subclass:#Explainer
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    16
	instanceVariableNames:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    17
	classVariableNames:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    18
	poolDictionaries:''
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    19
	category:'System-Compiler'
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    20
!
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    21
396
26c32f1f791b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    22
!Explainer class methodsFor:'documentation'!
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    23
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    24
copyright
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    25
"
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    26
 COPYRIGHT (c) 1993 by Claus Gittinger
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
    27
	      All Rights Reserved
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    28
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    29
 This software is furnished under a license and may be used
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    30
 only in accordance with the terms of that license and with the
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    32
 be provided or otherwise made available to, or used by, any
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    33
 other person.  No title to or ownership of the software is
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    34
 hereby transferred.
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    35
"
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    36
!
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    37
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    38
documentation
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    39
"
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    40
    a very simple explainer - much more should be added ...
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
    41
    This one is involved, when the 'explain' function is used in a 
84
claus
parents: 58
diff changeset
    42
    codeView (popup or via CMD-E).
263
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    43
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    44
    [author:]
3b21d0991eff documentation
Claus Gittinger <cg@exept.de>
parents: 146
diff changeset
    45
        Claus Gittinger
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    46
"
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    47
! !
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    48
396
26c32f1f791b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
    49
!Explainer class methodsFor:'explaining'!
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
    50
1316
30806ca08095 commonSuperClassOf: - allow for classes and names in arg
Claus Gittinger <cg@exept.de>
parents: 1289
diff changeset
    51
commonSuperClassOf:listOfClassesOrClassNames
1352
e9e91394ca1a Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1331
diff changeset
    52
    |common|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    53
1316
30806ca08095 commonSuperClassOf: - allow for classes and names in arg
Claus Gittinger <cg@exept.de>
parents: 1289
diff changeset
    54
    listOfClassesOrClassNames do:[:classOrClassName |
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    55
        |class|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    56
1316
30806ca08095 commonSuperClassOf: - allow for classes and names in arg
Claus Gittinger <cg@exept.de>
parents: 1289
diff changeset
    57
        class := classOrClassName isBehavior 
30806ca08095 commonSuperClassOf: - allow for classes and names in arg
Claus Gittinger <cg@exept.de>
parents: 1289
diff changeset
    58
                        ifTrue:[classOrClassName]
1352
e9e91394ca1a Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1331
diff changeset
    59
                        ifFalse:[Smalltalk classNamed:classOrClassName].
1317
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    60
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    61
        common isNil ifTrue:[
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    62
            common := class
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    63
        ] ifFalse:[
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    64
            (class isSubclassOf:common) ifTrue:[
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    65
                "keep common"
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    66
            ] ifFalse:[
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    67
                (common isSubclassOf:class) ifTrue:[
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    68
                    common := class
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    69
                ] ifFalse:[
1317
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    70
                    common := common commonSuperclass:class.
1151
a1173e82de18 fixed #commonSuperClassOf:
Claus Gittinger <cg@exept.de>
parents: 1081
diff changeset
    71
1317
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    72
"/                    "walk up, checking"
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    73
"/                    found := false.
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    74
"/
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    75
"/                    common allSuperclassesDo:[:sup |
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    76
"/                        (found not and:[class isSubclassOf:sup]) ifTrue:[
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    77
"/                            common := sup.
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    78
"/                            found := true.
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    79
"/                        ]
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    80
"/                    ].
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    81
"/                    found ifFalse:[
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    82
"/                        class allSuperclassesDo:[:sup |
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    83
"/                            (found not and:[common isSubclassOf:sup]) ifTrue:[
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    84
"/                                common := sup.
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    85
"/                                found := true.
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    86
"/                            ]
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    87
"/                        ].
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    88
"/                    ].
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    89
                ]
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    90
            ].
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    91
        ].
1317
064ed982ddf8 commonSuperClassOf: easier (fixed ?)
Claus Gittinger <cg@exept.de>
parents: 1316
diff changeset
    92
        (common isNil or:[common == Object]) ifTrue:[^ common].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    93
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    94
    ^ common
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    95
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
    96
    "Modified: 17.6.1996 / 17:09:21 / stefan"
336
b99c14f17afc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 290
diff changeset
    97
    "Modified: 5.9.1996 / 19:34:41 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    98
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
    99
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   100
explain:someText in:source forClass:aClass
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   101
    "Given a source and a substring of it, return a string containing
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   102
     an explanation.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   103
     This is just a q&d implementation - to be correct, it should use the parser,
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   104
     and explain from the parsetree (instead of doing string matches).
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   105
     This leads to some wrong explanations, for example if some string is
839
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   106
     used as selector within a string, or if a variable is named like a
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   107
     message selector. I.e. the explanation should be context sensitive.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   108
     Also, there could be much more detailed explanations."
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   109
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   110
    ^ self
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   111
        explain:someText in:source forClass:aClass short:false
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   112
!
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   113
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   114
explain:someText in:source forClass:aClass short:shortText
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   115
    "Given a source and a substring of it, return a string containing
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   116
     an explanation.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   117
     This is just a q&d implementation - to be correct, it should use the parser,
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   118
     and explain from the parsetree (instead of doing string matches).
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   119
     This leads to some wrong explanations, for example if some string is
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   120
     used as selector within a string, or if a variable is named like a
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   121
     message selector. I.e. the explanation should be context sensitive.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   122
     Also, there could be much more detailed explanations."
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   123
1159
24a034278a55 Remove unused method vars
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
   124
    |parser variables c string tmp
1289
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   125
     spc sym sel stringText clsName val valString|
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   126
675
a2f41004c24d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   127
    string := someText string withoutSeparators.
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   128
    stringText := string allBold.
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   129
    stringText := '''' , stringText , ''''.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   130
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   131
    "
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   132
     ask parser for variable names
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   133
    "
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   134
    parser := self parseMethod:source in:aClass ignoreErrors:true ignoreWarnings:true.
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   135
    parser notNil ifTrue:[
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   136
        "look for variables"
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   137
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   138
        variables := parser methodVars.
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   139
        (variables notNil and:[variables includes:string]) ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   140
            ^ stringText , ' is a method variable.'
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   141
        ].
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   142
        variables := parser methodArgs.
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   143
        (variables notNil and:[variables includes:string]) ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   144
            ^ stringText , ' is a method argument.'
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   145
        ]
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   146
    ].
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   147
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   148
    parser isNil ifTrue:[
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   149
        parser := self for:(ReadStream on:source) in:aClass
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   150
    ].
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   151
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   152
    "instvars"
84
claus
parents: 58
diff changeset
   153
    c := aClass whichClassDefinesInstVar:string.
claus
parents: 58
diff changeset
   154
    c notNil ifTrue:[
396
26c32f1f791b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   155
        c isMeta ifTrue:[
1211
91e94e294819 isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
   156
            clsName := c theNonMetaclass name.
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   157
            shortText ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   158
                ^ stringText , ' is a class instVar in ' , clsName , '.'
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   159
            ].
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   160
            ^ stringText, ' is a class instance variable in ' , clsName , '.'
396
26c32f1f791b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   161
        ].
26c32f1f791b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   162
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   163
        clsName := c name.
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   164
        shortText ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   165
            ^ stringText , ' is an instVar in ' , clsName , '.'
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   166
        ].
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   167
        ^ stringText , ' is an instance variable in ' , clsName , '.'
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   168
    ].
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   169
84
claus
parents: 58
diff changeset
   170
"/    variables := aClass allInstVarNames.
claus
parents: 58
diff changeset
   171
"/    (variables notNil and:[variables includes:string]) ifTrue:[
claus
parents: 58
diff changeset
   172
"/        "where is it"
claus
parents: 58
diff changeset
   173
"/        c := aClass.
1159
24a034278a55 Remove unused method vars
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
   174
"/        [c notNil] whileTrue:[ |v|
84
claus
parents: 58
diff changeset
   175
"/            v := c instVarNames.
claus
parents: 58
diff changeset
   176
"/            (v notNil and:[v includes:string]) ifTrue:[
claus
parents: 58
diff changeset
   177
"/                ^ string , ' is an instance variable in ' , c name
claus
parents: 58
diff changeset
   178
"/            ].
claus
parents: 58
diff changeset
   179
"/            c := c superclass
claus
parents: 58
diff changeset
   180
"/        ].
claus
parents: 58
diff changeset
   181
"/        self error:'oops'
claus
parents: 58
diff changeset
   182
"/    ].
claus
parents: 58
diff changeset
   183
442
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   184
"/    "class instvars"
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   185
"/    variables := aClass class allInstVarNames.
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   186
"/    (variables notNil and:[variables includes:string]) ifTrue:[
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   187
"/        "where is it"
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   188
"/        c := aClass.
1159
24a034278a55 Remove unused method vars
Stefan Vogel <sv@exept.de>
parents: 1151
diff changeset
   189
"/        [c notNil] whileTrue:[ |v|
442
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   190
"/            v := c class instVarNames.
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   191
"/            (v notNil and:[v includes:string]) ifTrue:[
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   192
"/                ^ string , ' is a class instance variable in ' , c name
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   193
"/            ].
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   194
"/            c := c superclass
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   195
"/        ].
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   196
"/        self error:'oops'
80b2e3bf3e93 explaining class-instVars
Claus Gittinger <cg@exept.de>
parents: 422
diff changeset
   197
"/    ].
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   198
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   199
    "classvars"
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   200
    c := parser inWhichClassIsClassVar:string.
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   201
    c notNil ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   202
        clsName := c name.
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   203
        shortText ifTrue:[
1289
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   204
            stringText := stringText , ' is a classVar in ' , clsName 
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   205
        ] ifFalse:[
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   206
            stringText := stringText , ' is a class variable in ' , clsName
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   207
        ].
1289
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   208
        val := Smalltalk at:(clsName , ':' , string) asSymbol.
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   209
        (val isBoolean or:[val isNil or:[val isSymbol]]) ifTrue:[
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   210
            valString := val storeString.
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   211
        ] ifFalse:[
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   212
            valString := val classNameWithArticle.
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   213
        ].
2434f1ee11ee show classVars
Claus Gittinger <cg@exept.de>
parents: 1256
diff changeset
   214
        ^ stringText , ' (' , valString , ').'
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   215
    ].
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   216
1210
e3174ccbb5bb isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents: 1198
diff changeset
   217
    c := aClass theNonMetaclass.
509
d8475399ca3e Correct handling of private classes.
Stefan Vogel <sv@exept.de>
parents: 503
diff changeset
   218
    c privateClasses do:[:pClass |
d8475399ca3e Correct handling of private classes.
Stefan Vogel <sv@exept.de>
parents: 503
diff changeset
   219
        (pClass name = string 
d8475399ca3e Correct handling of private classes.
Stefan Vogel <sv@exept.de>
parents: 503
diff changeset
   220
         or:[pClass nameWithoutPrefix = string]) ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   221
            string := stringText , ' is a private class in ''' , c name , '''.'.
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   222
            shortText ifFalse:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   223
                string := (string , '\\It is only visible locally.') withCRs
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   224
            ].
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   225
            ^ string withCRs
422
bdc16e1e31ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   226
        ].
bdc16e1e31ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   227
    ].
bdc16e1e31ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   228
456
abe32fed9c0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 442
diff changeset
   229
    (spc := aClass nameSpace) notNil ifTrue:[
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   230
        sym := (spc name , '::' , string) asSymbolIfInterned.
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   231
        sym notNil ifTrue:[
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   232
            (Smalltalk at:sym) isBehavior ifTrue:[
1233
1015bcce9646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1232
diff changeset
   233
                string :=  stringText , ' is a class in the ''' , spc name , ''' nameSpace.'.
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   234
                shortText ifFalse:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   235
                    string := (string 
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   236
                         , '\\It is only visible within this nameSpace.'
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   237
                         , '\Access from the outside is possible'
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   238
                         , '\by the special name ''' , spc name , '::' , string , '''.') withCRs
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   239
                ].
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   240
                ^ string withCRs
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   241
            ].
422
bdc16e1e31ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   242
        ].
bdc16e1e31ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   243
    ].
bdc16e1e31ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 396
diff changeset
   244
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   245
"/    string knownAsSymbol ifTrue:[
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   246
        "globals & symbols"
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   247
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   248
        tmp := self explainKnownSymbol:string inClass:aClass short:shortText.
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   249
        tmp notNil ifTrue:[ ^ tmp].
839
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   250
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   251
        "/ try with added colon ...
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   252
        sel := string , ':'.
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   253
        Symbol allInstancesDo:[:sym |
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   254
            (sym startsWith:sel) ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   255
                tmp := self explainKnownSymbol:sym inClass:aClass short:shortText.
839
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   256
                tmp notNil ifTrue:[ ^ tmp].
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   257
            ]
021af12ebd18 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 835
diff changeset
   258
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   259
"/    ].
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   260
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   261
    "try for some obvious things"
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   262
    tmp := self explainPseudoVariable:string in:aClass short:true.
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   263
    tmp notNil ifTrue:[ ^ tmp].
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   264
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   265
    "try syntax ..."
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   266
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   267
    tmp := self explainSyntax:string short:shortText.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   268
    tmp notNil ifTrue:[ ^ tmp].
20
f8dd8ba75205 *** empty log message ***
claus
parents: 15
diff changeset
   269
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   270
    shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   271
        ^ ''
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   272
    ].
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   273
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   274
    parser isNil ifTrue:[
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   275
        ^ 'parse error - no explanation'
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   276
    ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   277
    ^ 'cannot explain this (could not figure out what this is).'
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   278
675
a2f41004c24d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   279
    "Created: / 3.12.1995 / 12:47:37 / cg"
a2f41004c24d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   280
    "Modified: / 16.4.1997 / 12:46:11 / stefan"
1211
91e94e294819 isMeta/soleInstance -> theMetaclass / theNonMetaclass
Claus Gittinger <cg@exept.de>
parents: 1210
diff changeset
   281
    "Modified: / 5.11.2001 / 16:54:23 / cg"
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   282
!
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   283
1188
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   284
explainGlobal:string inClass:aClass short:shortText
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   285
    "return explanation or nil"
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   286
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   287
    |sym stringText tmp val classCategory|
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   288
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   289
    "if not even known as key, its definitely not a global"
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   290
    sym := string asSymbolIfInterned. 
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   291
    sym isNil ifTrue:[^ nil].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   292
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   293
    "try globals"
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   294
    (Smalltalk includesKey:sym) ifFalse:[ ^ nil].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   295
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   296
    stringText := string allBold.
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   297
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   298
    "/ stringText := '''' , stringText , ''''.
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   299
    tmp := stringText , ' is a global variable.'.
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   300
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   301
    val := Smalltalk at:sym.
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   302
    val isBehavior ifTrue:[
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   303
        "/ a class
1331
0951a2122a85 Fix obsolete method usage
Stefan Vogel <sv@exept.de>
parents: 1330
diff changeset
   304
        val isNameSpace ifTrue:[
1330
100f022924b6 oops - care for namespaces
ca
parents: 1317
diff changeset
   305
            ^ stringText , ' is a namespace.'
100f022924b6 oops - care for namespaces
ca
parents: 1317
diff changeset
   306
        ].
100f022924b6 oops - care for namespaces
ca
parents: 1317
diff changeset
   307
100f022924b6 oops - care for namespaces
ca
parents: 1317
diff changeset
   308
        classCategory := val category ? 'uncategorized'.
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   309
        shortText ifTrue:[
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   310
            ^ stringText , ' is ' , (val isLoaded ifTrue:['a'] ifFalse:['an autoloaded'])
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   311
, ' class in the ''' , classCategory , ''' category.'.
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   312
        ].
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   313
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   314
        val name = string ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   315
            tmp := tmp , '
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   316
' , string , ' is ' , (val isLoaded ifTrue:['a'] ifFalse:['an autoloaded'])
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   317
, ' class categorized as ' , classCategory , '
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   318
in the ''' , val package , ''' package.'.
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   319
            ^ tmp.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   320
        ].
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   321
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   322
        tmp := tmp , '
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   323
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   324
' , string , ' is bound to the class ' , val name ,
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   325
' in the ''' , classCategory , ''' category.'.
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   326
        ^ tmp.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   327
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   328
1245
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   329
    shortText ifTrue:[
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   330
        ^ stringText , ' is a global, currently bound to ''' , val classNameWithArticle , '''.'.
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   331
    ].
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   332
    tmp := tmp , '
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   333
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   334
Its current value is ''' , val classNameWithArticle , '''.'.
fa98b7f89dd3 explaining
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
   335
    ^ tmp.
1188
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   336
!
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   337
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   338
explainHereIn:aClass
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   339
    ^ 'like self, here refers to the object which received the message.
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   340
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   341
However, when sending a message to here the search for methods
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   342
implementing this message will start in the defining class (' , aClass name , ')
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   343
instead of the receivers class (' , aClass name , ' or subclass).
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   344
Thus, using here, redefined methods will NOT be reached with a here-send.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   345
!
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   346
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   347
explainKnownSymbol:string inClass:aClass
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   348
    "return explanation or nil"
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   349
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   350
    ^ self explainKnownSymbol:string inClass:aClass short:false
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   351
!
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   352
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   353
explainKnownSymbol:string inClass:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   354
    "return explanation or nil"
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   355
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   356
    |sym|
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   357
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   358
    sym := string asSymbolIfInterned.
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   359
    sym isNil ifTrue:[^ nil].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   360
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   361
    "try globals"
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   362
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   363
    (Smalltalk includesKey:sym) ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   364
        ^ self explainGlobal:string inClass:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   365
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   366
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   367
    ^ self explainSelector:string inClass:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   368
!
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   369
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   370
explainPseudoVariable:string in:aClass
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   371
    "return explanation for the pseudoVariables self, super etc."
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   372
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   373
    ^ self explainPseudoVariable:string in:aClass short:false
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   374
!
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   375
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   376
explainPseudoVariable:string in:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   377
    "return explanation for the pseudoVariables self, super etc."
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   378
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   379
    (string = 'self') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   380
        ^ self explainSelfIn:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   381
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   382
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   383
    (string = 'super') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   384
        shortText ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   385
            ^ '''super'' - message lookup starts in superclass ''' , aClass superclass name , '''.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   386
        ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   387
        ^ self explainSuperIn:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   388
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   389
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   390
    (string = 'here') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   391
        shortText ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   392
            ^ '''here'' - message lookup always starts in ''' , aClass name , '''.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   393
        ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   394
        ^ self explainHereIn:aClass
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   395
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   396
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   397
    (string = 'thisContext') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   398
        shortText ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   399
            ^ '''thisContext'' - the current stack frame as an object.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   400
        ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   401
        ^ 'thisContext is a pseudo variable (i.e. it is built in).
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   402
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   403
ThisContext always refers to the context object for the currently executed method or
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   404
block (an instance of Context or BlockContext respectively). The calling chain and calling
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   405
receivers/selectors can be accessed via thisContext.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   406
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   407
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   408
    (string = 'true') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   409
        shortText ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   410
            ^ '''true'' - the truth and nothing but the truth.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   411
        ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   412
        ^ 'true is a pseudo variable (i.e. it is built in).
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   413
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   414
True represents logical truth. It is the one and only instance of class True.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   415
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   416
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   417
    (string = 'false') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   418
        shortText ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   419
            ^ '''false'' - obvisously not true.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   420
        ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   421
        ^ 'false is a pseudo variable (i.e. it is built in).
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   422
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   423
False represents logical falseness. It is the one and only instance of class False.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   424
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   425
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   426
    (string = 'nil') ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   427
        shortText ifTrue:[
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   428
            ^ '''nil'' - undefined, unknown, void or dont care.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   429
        ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   430
        ^ 'nil is a pseudo variable (i.e. it is built in).
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   431
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   432
Nil is used for unitialized variables (among other uses).
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   433
Nil is the one and only instance of class UndefinedObject.'
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   434
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   435
    ^ nil
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   436
!
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   437
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   438
explainSelector:string inClass:aClass short:shortText
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   439
    "return explanation or nil"
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   440
1352
e9e91394ca1a Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1331
diff changeset
   441
    |sym list count tmp commonSuperClass s s2 
1188
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   442
     firstImplementingClass cm msg t|
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   443
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   444
    sym := string asSymbolIfInterned.
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   445
    sym isNil ifTrue:[^ nil].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   446
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   447
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   448
     try selectors
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   449
     look who implements it
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   450
    "
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   451
    list := Set new.
1081
6e6255672d68 allBehaviors vs. allClasses
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   452
    Smalltalk allClassesDo:[:c|
1249
780b4a1a3967 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   453
        (c includesSelector:sym) ifTrue:[
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   454
            list add:(c name).
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   455
            firstImplementingClass isNil ifTrue:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   456
                firstImplementingClass := c
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   457
            ]
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   458
        ].
1249
780b4a1a3967 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   459
        (c class includesSelector:sym) ifTrue:[
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   460
            list add:(c name , ' class').
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   461
            firstImplementingClass isNil ifTrue:[
912
41eaf4909608 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 911
diff changeset
   462
                firstImplementingClass := c class
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   463
            ]
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   464
        ]
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   465
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   466
835
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   467
    (aClass canUnderstand:sym) ifTrue:[
1184
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   468
        s2 := ('Instances of ''' , aClass name , ''' respond to #') , sym asText allBold , '.'.
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   469
        shortText ifFalse:[
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   470
            s2 := '\\' , s2 
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   471
                  , '\- inherited from ' withCRs
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   472
                  , (aClass whichClassImplements:sym) name asText allBold.
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   473
        ].
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   474
        firstImplementingClass := (aClass whichClassImplements:sym)
835
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   475
    ] ifFalse:[
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   476
        s2 := ''.
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   477
    ].
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   478
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   479
    count := list size.
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   480
    (count ~~ 0) ifTrue:[
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   481
        "
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   482
         for up-to 4 implementing classes,
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   483
         list them
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   484
        "
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   485
        list := list asOrderedCollection sort.
1185
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   486
        shortText ifTrue:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   487
            tmp := ' is implemented in '.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   488
        ] ifFalse:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   489
            tmp := ' is a selector implemented in '.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   490
        ].
835
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   491
        s := '#' , string asText allBold.
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   492
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   493
        (count == 1) ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   494
            (t := list first) isMeta ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   495
                t := 'the ' , t
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   496
            ].
1184
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   497
            msg := s , tmp , t , '.'.
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   498
            shortText ifFalse:[
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   499
                msg := msg , s2.
b091e74f640f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1183
diff changeset
   500
            ]
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   501
        ] ifFalse:[
1185
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   502
            (count == 2) ifTrue:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   503
                msg := s , tmp , (list at:1) , ' and ' , (list at:2) , '.'.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   504
                shortText ifFalse:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   505
                    msg := msg , s2.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   506
                ].
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   507
            ] ifFalse:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   508
                shortText ifTrue:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   509
                    msg := s , tmp , count printString , ' classes.'.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   510
                    ^ msg
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   511
                ].
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   512
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   513
                (count == 3) ifTrue:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   514
                    msg := s , tmp , '
835
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   515
' , (list at:1) , ', ' , (list at:2) , ' and ' , (list at:3) , '.' , s2
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   516
                ] ifFalse:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   517
                    (count == 4) ifTrue:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   518
                        msg := s , tmp , '
835
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   519
' , (list at:1) , ', ' , (list at:2) , ', ' , (list at:3), ' and ' , (list at:4) , '.' , s2
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   520
                    ] ifFalse:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   521
                        "
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   522
                         if there are more, look for a common
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   523
                         superclass and show it ...
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   524
                        "
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   525
                        commonSuperClass := self commonSuperClassOf:list.
913
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   526
                        (commonSuperClass ~~ Object 
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   527
                        and:[commonSuperClass ~~ Behavior
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   528
                        and:[commonSuperClass ~~ Class
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   529
                        and:[commonSuperClass ~~ ClassDescription]]]) ifTrue:[
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   530
                            (list includes:commonSuperClass) ifTrue:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   531
                                msg := s . tmp , count printString , commonSuperClass name 
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   532
                                         , ' and redefined in ' , (count - 1) printString  
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   533
                                         , ' subclasses'
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   534
                                         , s2.
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   535
                                firstImplementingClass := commonSuperClass
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   536
                            ] ifFalse:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   537
                                msg := s , tmp, count printString , ' subclasses of ' , commonSuperClass name , s2
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   538
                            ]
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   539
                        ] ifFalse:[
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   540
                            (commonSuperClass == Object
1249
780b4a1a3967 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   541
                            and:[commonSuperClass includesSelector:sym]) ifTrue:[
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   542
                                msg := s , tmp , count printString , ' classes.
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   543
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   544
All objects seem to respond to that message, 
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   545
since there is an implementation in Object.' , s2.
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   546
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   547
                                firstImplementingClass := Object
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   548
                            ] ifFalse:[
913
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   549
                                ((commonSuperClass == Behavior
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   550
                                 or:[commonSuperClass == Class
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   551
                                 or:[commonSuperClass == ClassDescription]])
1249
780b4a1a3967 implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1245
diff changeset
   552
                                and:[commonSuperClass includesSelector:sym]) ifTrue:[
913
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   553
                                    msg := s , tmp , count printString , ' classes.
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   554
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   555
All classes seem to respond to that message, 
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   556
since there is an implementation in ' , commonSuperClass name , '.' , s2.
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   557
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   558
                                    firstImplementingClass := commonSuperClass
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   559
                                ] ifFalse:[
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   560
                                    "
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   561
                                     otherwise just give the number.
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   562
                                    "
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   563
                                    msg := s , tmp , count printString , ' classes.' , s2
bd05fb9dbc9a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   564
                                ]
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   565
                            ]
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   566
                        ]
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   567
                    ]
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   568
                ]
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   569
            ].
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   570
        ].
1185
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   571
        shortText ifFalse:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   572
            firstImplementingClass notNil ifTrue:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   573
                WindowGroup activeGroup withWaitCursorDo:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   574
                    cm := firstImplementingClass compiledMethodAt:sym.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   575
                    cm notNil ifTrue:[
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   576
                        cm := cm methodComment.
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   577
                    ]
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   578
                ].
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   579
                cm notNil ifTrue:[
1185
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   580
                    msg := msg , '\\The comment in ' withCRs , firstImplementingClass name allBold , ' is:\' withCRs , cm allItalic.
911
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   581
                ]
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   582
            ].
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   583
        ].
be6ce6482a7f extract the methods comment and show it.
Claus Gittinger <cg@exept.de>
parents: 839
diff changeset
   584
        ^ msg
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   585
    ].
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   586
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   587
    ^ nil
290
d1650b17b9e9 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 263
diff changeset
   588
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   589
    "Modified: / 17.6.1996 / 17:09:30 / stefan"
835
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   590
    "Created: / 23.3.1999 / 13:29:33 / cg"
84c5b20b91c5 more explaining
Claus Gittinger <cg@exept.de>
parents: 834
diff changeset
   591
    "Modified: / 23.3.1999 / 13:40:40 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   592
!
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   593
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   594
explainSelfIn:aClass short:shortText
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   595
    |sub subNames selfString className nSubClasses|
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   596
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   597
    selfString := '''' , 'self' allBold , ''''.
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   598
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   599
    sub := aClass allSubclasses.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   600
    nSubClasses := sub size.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   601
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   602
    aClass isMeta ifTrue:[
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   603
        className := aClass theNonMetaclass name.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   604
        subNames := sub collect:[:c | c theNonMetaclass name].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   605
        nSubClasses == 0 ifTrue:[
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   606
            shortText ifTrue:[
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   607
                ^ selfString , ' - the ''' , className , '''-class.'
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   608
            ].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   609
            ^ selfString , 'refers to the object which received the message.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   610
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   611
In this case, it will be the ' , className , '-class itself.'
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   612
        ].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   613
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   614
        shortText ifTrue:[
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   615
            nSubClasses == 1 ifTrue:[
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   616
                ^ selfString , ' - the ''' , className , '''- or ''' , subNames first , '''-class.'
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   617
            ].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   618
            ^ selfString , ' - the ''' , className , '''-class or one of its subclasses.'
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   619
        ].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   620
        nSubClasses <= 5 ifTrue:[
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   621
            ^ selfString , ' refers to the object which received the message.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   622
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   623
In this case, it will be the ' , className , '-class
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   624
or one of its subclasses:
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   625
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   626
' , subNames asStringCollection asString
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   627
        ].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   628
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   629
        ^ selfString , ' refers to the object which received the message.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   630
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   631
In this case, it will be the ' , className , '-class
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   632
or one of its ' , nSubClasses printString , ' subclasses.'
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   633
    ].
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   634
1256
cc3fa02585ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   635
    subNames := aClass allSubclasses collect:[:c | c theNonMetaclass name].
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   636
    className := aClass name.
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   637
    nSubClasses == 0 ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   638
        shortText ifTrue:[
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   639
            ^ selfString , ' - an instance of ''' , className , '''.'
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   640
        ].
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   641
        ^ selfString , 'refers to the object which received the message.
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   642
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   643
In this case, it will be an instance of ' , className , '.'
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   644
    ].
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   645
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   646
    shortText ifTrue:[
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   647
        nSubClasses == 1 ifTrue:[
1256
cc3fa02585ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   648
            ^ selfString , ' - an instance of ''' , className , ''' or ''' , subNames first , '''.'
1185
7030f795b00d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1184
diff changeset
   649
        ].
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   650
        ^ selfString , ' - an instance of ''' , className , ''' or one of its subclasses.'
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   651
    ].
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   652
    nSubClasses <= 5 ifTrue:[
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   653
        ^ selfString , ' refers to the object which received the message.
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   654
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   655
In this case, it will be an instance of ' , className , '
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   656
or one of its subclasses:
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   657
1256
cc3fa02585ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
   658
' , subNames asStringCollection asString
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   659
    ].
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   660
1198
f81479b0d838 better explanations
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   661
    ^ selfString , ' refers to the object which received the message.
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   662
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   663
In this case, it will be an instance of ' , className , '
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   664
or one of its ' , nSubClasses printString , ' subclasses.'
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   665
!
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   666
1188
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   667
explainSuperIn:aClass short:shortText
1352
e9e91394ca1a Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1331
diff changeset
   668
    |superName|
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   669
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   670
    superName := aClass superclass name.
1188
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   671
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   672
    shortText ifTrue:[
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   673
        ^ '''super'' - message lookup starts in ' , superName , '.'
1188
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   674
    ].
8c0408dc39f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1185
diff changeset
   675
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   676
    ^ 'like self, super refers to the object which received the message.
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   677
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   678
However, when sending a message to super the search for methods
1244
e9bb700040fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
   679
implementing this message will start in the superclass (' , superName , ')
84
claus
parents: 58
diff changeset
   680
instead of the receivers class (' , aClass name , ' or subclass).
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   681
Thus, using super, a redefined method can call the original method in its superclass.'
6
0cd4e7480440 *** empty log message ***
claus
parents: 2
diff changeset
   682
!
2
0aae80a0ae84 Initial revision
claus
parents:
diff changeset
   683
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   684
explainSyntax:string
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   685
    "try syntax ...; return explanation or nil"
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   686
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   687
    ^ self explainSyntax:string short:false
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   688
!
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   689
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   690
explainSyntax:string short:shortText
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   691
    "try syntax ...; return explanation or nil"
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   692
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   693
    ((string = ':=') or:[string = '_']) ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   694
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   695
            ^ 'Assign to variable on the left side.'.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   696
        ].
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   697
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   698
        ^ '<variable> := <expression>
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   699
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   700
'':='' and ''_'' (which is left-arrow in some fonts) mean assignment.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   701
The variable is bound to (i.e. points to) the value of <expression>.'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   702
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   703
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   704
    (string = '^') ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   705
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   706
            ^ 'Return value from method.'.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   707
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   708
        ^ '^ <expression>
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   709
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   710
returns the value of <expression> as value from the method.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   711
A return from within a block exits the method where the block is defined.'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   712
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   713
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   714
    (string = ';') ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   715
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   716
            ^ 'Cascade expression.'.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   717
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   718
        ^ '<expression> ; selector1 ; .... ; selectorN
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   719
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   720
a cascade expression; evaluate expression, and send messages 
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   721
<selector1> ... <selectorN> to the first expressions receiver. 
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   722
Returns the value of the last send. The cascade sends may also have arguments.'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   723
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   724
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   725
    (string = '|') ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   726
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   727
            ^ ''.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   728
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   729
        ^ '| locals |  or: [:arg | statements]
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   730
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   731
''|'' is used to mark a local variable declaration or separates arguments
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   732
from the statements in a block. Notice, that in a block-argument declaration
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   733
these must be prefixed by a colon character.
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   734
''|'' is also a selector understood by Booleans.'
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   735
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   736
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   737
    ((string startsWith:'(') or:[string endsWith:')']) ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   738
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   739
            ^ ''.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   740
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   741
        ^ '(<expression>)
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   742
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   743
expression grouping.'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   744
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   745
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   746
    ((string startsWith:'[') or:[string endsWith:']']) ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   747
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   748
            ^ ''.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   749
        ].
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   750
        ^ '[:arg1 .. :argN | statements]
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   751
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   752
defines a block. 
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   753
Blocks represent pieces of executable code. Definition of a block does
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   754
not evaluate it. The block is evaluated by sending it a value/value:
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   755
message.
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   756
Blocks are often passed as arguments to Booleans (i.e. ifTrue:[...]) or
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   757
collections (i.e. do:[...]).'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   758
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   759
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   760
    (string = ':') ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   761
        shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   762
            ^ ''.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   763
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   764
        ^ 'colons have different meaning depending on context:
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   765
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   766
1) they separate keyword-parts in symbols and keyword-messages as in:
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   767
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   768
    #at:put:                     a constant keyword symbol
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   769
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   770
    rec at:index put:value       sends the #at:put: message to rec,
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   771
                                 passing index and value as arguments.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   772
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   773
2) within block-argument declarations as in:
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   774
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   775
    [:arg1 :arg2 | statements]
834
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   776
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   777
3) within an identifier, they separate the nameSpace part from
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   778
   the name part; as in:
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   779
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   780
    Smalltalk::Array    - the Array class in the Smalltalk nameSpace.
34cef8ff7c05 more explaining
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   781
    Foo::Array          - the Array class in the Foo nameSpace.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   782
'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   783
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   784
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   785
    (string = '.') ifTrue:[
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   786
        ^ 'statement. "<- period here"
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   787
statement
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   788
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   789
within a method or block, individual statements are separated by periods.
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   790
'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   791
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   792
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   793
    (string startsWith:'#' ) ifTrue:[
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   794
        (string startsWith:'#(' ) ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   795
            shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   796
                ^ 'Array Literal.'.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   797
            ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   798
            ^ 'is a constant Array.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   799
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   800
The elements of a constant Array must be Number-constants, nil, true or false.
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   801
(notice, that not all Smalltalk implementations allow true, false and nil as
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   802
 constant-Array elements).'
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   803
        ].
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   804
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   805
        (string startsWith:'#[') ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   806
            shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   807
                ^ 'ByteArray Literal.'.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   808
            ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   809
            ^ 'is a constant ByteArray.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   810
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   811
The elements of a constant ByteArray must be Integer constants in the range
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   812
0 .. 255.
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   813
(notice, that not all Smalltalk implementations support constant ByteArrays).'
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   814
        ].
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   815
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   816
        (string startsWith:'#''') ifTrue:[
1183
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   817
            shortText ifTrue:[
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   818
                ^ 'Symbol Literal.'.
39f5ca4778d5 added short explanations
Claus Gittinger <cg@exept.de>
parents: 1168
diff changeset
   819
            ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   820
            ^ 'is a constant symbol containing non-alphanumeric characters.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   821
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   822
Symbols are unique strings, meaning that there exists
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   823
exactly one instance of a given symbol. Therefore symbols can
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   824
be compared using == (identity compare) in addition to = (contents compare).
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   825
Beside this, Symbols behave mostly like Strings.
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   826
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   827
Notice, that not all Smalltalk implementations support this kind of symbols.'
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   828
        ].
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   829
1232
2113cc4dd269 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   830
        shortText ifTrue:[
2113cc4dd269 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   831
            ^ 'Symbol Literal.'.
2113cc4dd269 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1211
diff changeset
   832
        ].
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   833
        ^ 'is a symbol.
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   834
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   835
Symbols are unique strings, meaning that there exists
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   836
exactly one instance of a given symbol. Therefore symbols can
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   837
be compared using == (identity compare) in addition to = (contents compare).
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   838
Beside this, Symbols behave mostly like Strings.'
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   839
    ].
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   840
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   841
    "/ is it a symbol without hash-character ?
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   842
    "/
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   843
"/    string knownAsSymbol ifTrue:[
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   844
"/        ^ 'is nothing, but #' , string , ' is known as a symbol.
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   845
"/
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   846
"/Symbols are unique strings, meaning that there exists
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   847
"/exactly one instance of a given symbol. Therefore symbols can
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   848
"/be compared using == (identity compare) in addition to = (contents compare).
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   849
"/Beside this, Symbols behave mostly like Strings.'
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   850
"/    ].
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   851
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   852
    ^ nil
796
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   853
65a547620ef4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   854
    "Modified: / 31.10.1998 / 14:28:58 / cg"
141
d378d997aab0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 135
diff changeset
   855
! !
49
02660b790c3e *** empty log message ***
claus
parents: 24
diff changeset
   856
396
26c32f1f791b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 336
diff changeset
   857
!Explainer class methodsFor:'documentation'!
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   858
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   859
version
1352
e9e91394ca1a Remove unused method variables
Stefan Vogel <sv@exept.de>
parents: 1331
diff changeset
   860
    ^ '$Header: /cvs/stx/stx/libcomp/Explainer.st,v 1.58 2002-11-26 16:19:10 stefan Exp $'
146
3d407ab8ac44 suppress messages on transcript when explaining
Claus Gittinger <cg@exept.de>
parents: 141
diff changeset
   861
! !