author | Claus Gittinger <cg@exept.de> |
Thu, 30 Jul 2009 10:03:40 +0200 | |
changeset 11819 | ad671b753451 |
parent 11773 | ac4ceea3f464 |
child 11859 | 752a9509eadf |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
159 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5434 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
3985 | 14 |
String variableByteSubclass:#Symbol |
1020 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Collections-Text' |
|
1 | 19 |
! |
20 |
||
77 | 21 |
!Symbol class methodsFor:'documentation'! |
1 | 22 |
|
88 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
159 | 26 |
All Rights Reserved |
88 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
77 | 37 |
documentation |
38 |
" |
|
39 |
Symbols represent unique strings - every symbol with same printString |
|
40 |
exists exactly once in the system; Symbols are used for selectors, global |
|
345 | 41 |
variable-keys etc. Symbols can also be used to represent things which are |
42 |
enumeration type values in other programming languages (since symbols are |
|
370 | 43 |
created at compile time, comparing them using == is a fast pointer compare). |
345 | 44 |
|
45 |
A symbol may not change its characters - i.e. it is constant over its lifetime. |
|
46 |
Other than that, symbols behave much like strings. |
|
1290 | 47 |
|
48 |
[author:] |
|
2200 | 49 |
Claus Gittinger |
77 | 50 |
" |
51 |
! ! |
|
1 | 52 |
|
77 | 53 |
!Symbol class methodsFor:'instance creation'! |
1 | 54 |
|
62 | 55 |
basicNew:size |
56 |
"redefined to return a string instead of a symbol - |
|
57 |
this allows all copy methods inherited from String to |
|
58 |
return strings containing the symbols characters. |
|
1020 | 59 |
Real symbols are only created with #intern: or #asSymbol." |
62 | 60 |
|
61 |
^ String new:size |
|
1020 | 62 |
|
63 |
"Modified: 26.2.1996 / 12:51:38 / cg" |
|
62 | 64 |
! |
65 |
||
77 | 66 |
fromString:aString |
67 |
"same as intern: for Symbol, but may be used to create interned instances |
|
68 |
of subclasses. |
|
69 |
Notice: this fails, if you try to intern an instance of a subclass, AND |
|
70 |
a symbol with the same name already exists. In this case, the original |
|
71 |
symbol is returned. To use it for enum-type symbols, make certain, that the |
|
72 |
names are unique (for example by including the classes name as a prefix-string)." |
|
73 |
||
267 | 74 |
|sym len| |
77 | 75 |
|
267 | 76 |
sym := aString asSymbolIfInterned. |
77 |
sym notNil ifTrue:[ |
|
78 |
^ sym |
|
77 | 79 |
]. |
80 |
||
81 |
" |
|
82 |
create a new uninterned instance first |
|
83 |
" |
|
84 |
len := aString size. |
|
267 | 85 |
sym := super basicNew:len. |
86 |
sym replaceFrom:1 to:len with:aString. |
|
77 | 87 |
|
88 |
"now, intern it" |
|
89 |
%{ |
|
329 | 90 |
sym = __INTERNSYMBOL(sym, (OBJ *)0, __context); |
77 | 91 |
%}. |
267 | 92 |
^ sym |
77 | 93 |
! |
94 |
||
608 | 95 |
intern:aString |
96 |
"return a unique symbol with printname taken from the String-argument" |
|
97 |
||
98 |
%{ /* NOCONTEXT */ |
|
99 |
OBJ newSymbol; |
|
100 |
||
101 |
if (__isSymbol(aString)) { |
|
102 |
RETURN (aString); |
|
103 |
} |
|
104 |
if (__isString(aString)) { |
|
2200 | 105 |
newSymbol = __MKSYMBOL(__stringVal(aString), (OBJ *)0); |
608 | 106 |
if (newSymbol != nil) { |
107 |
RETURN (newSymbol); |
|
108 |
} |
|
109 |
} |
|
110 |
%}. |
|
111 |
aString class ~~ String ifTrue:[ |
|
112 |
"/ |
|
113 |
"/ only allowed to intern strings |
|
114 |
"/ |
|
115 |
^ self mustBeString |
|
116 |
]. |
|
117 |
^ ObjectMemory allocationFailureSignal raise. |
|
118 |
! |
|
119 |
||
1 | 120 |
internCharacter:aCharacter |
121 |
"return a unique symbol with printname taken from the Character-argument" |
|
122 |
||
123 |
^ self intern:(aCharacter asString) |
|
608 | 124 |
! |
125 |
||
126 |
new:size |
|
127 |
"redefined to return a string instead of a symbol - |
|
128 |
this allows all copy methods inherited from String to |
|
129 |
return strings containing the symbols characters. |
|
130 |
Real symbols are only created with intern: or asSymbol." |
|
131 |
||
132 |
^ String new:size |
|
133 |
! ! |
|
134 |
||
7301 | 135 |
!Symbol class methodsFor:'Compatibility-ST80'! |
2570
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
136 |
|
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
137 |
tableSize |
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
138 |
"return the size of the systems symbol table" |
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
139 |
|
4838 | 140 |
"/ claus: I dont know, if the returned value should be exact. |
141 |
"/ the number below is just arbitrary ... |
|
2570
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
142 |
|
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
143 |
^ 10000 |
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
144 |
|
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
145 |
"Created: 18.4.1997 / 20:52:20 / cg" |
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
146 |
! ! |
26616a00d5aa
added #tableSize for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents:
2565
diff
changeset
|
147 |
|
1 | 148 |
|
149 |
!Symbol class methodsFor:'queries'! |
|
150 |
||
608 | 151 |
findInterned:aString |
152 |
"for ST-80 compatibility - if the argument, aString is known |
|
153 |
as Symbol, return this symbol. Otherwise return nil." |
|
154 |
||
155 |
^ aString asSymbolIfInterned |
|
156 |
! |
|
157 |
||
158 |
hasInterned:aString |
|
159 |
"return true, if the argument, aString is known as Symbol; |
|
160 |
false otherwise" |
|
161 |
||
162 |
^ aString knownAsSymbol |
|
163 |
! |
|
164 |
||
1 | 165 |
hasInterned:aString ifTrue:trueBlock |
166 |
"for ST-80 compatibility - if the argument, aString is known |
|
167 |
as Symbol, evaluate the block with the corresponding symbol |
|
168 |
as argument and return true; otherwise return false" |
|
169 |
||
275 | 170 |
|sym| |
171 |
||
172 |
(sym := aString asSymbolIfInterned) notNil ifTrue:[ |
|
173 |
trueBlock value:sym. |
|
159 | 174 |
^ true |
1 | 175 |
]. |
176 |
^ false |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
177 |
! |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
178 |
|
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
179 |
hasSharedInstances |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
180 |
"return true if this class has shared instances, that is, instances |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
181 |
with the same value are identical. |
4654 | 182 |
True returned here - there is only one of each symbol (per contents)." |
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
183 |
|
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
184 |
^ true |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
185 |
|
1 | 186 |
! ! |
187 |
||
11819 | 188 |
!Symbol methodsFor:'*magritte-model-converting'! |
189 |
||
190 |
asAccessor |
|
191 |
^ Magritte::MASelectorAccessor selector: self |
|
192 |
! ! |
|
193 |
||
194 |
||
195 |
!Symbol methodsFor:'Compatibility-Squeak'! |
|
196 |
||
197 |
isUnary |
|
198 |
^ self isUnarySelector |
|
199 |
! ! |
|
200 |
||
7261 | 201 |
!Symbol methodsFor:'Compatibility-VW'! |
7153 | 202 |
|
203 |
<< catalogID |
|
204 |
"create and return a new UserMessage, with the receiver as key, |
|
205 |
and the argument as cataglogID. |
|
206 |
VW compatibility." |
|
207 |
||
208 |
^ UserMessage key:self catalogID:catalogID |
|
209 |
||
210 |
" |
|
211 |
(#theFooMessage << #myMessages) |
|
212 |
(#theFooMessage << #myMessages >> 'cannot read subclass of metaclass') |
|
213 |
(#theFooMessage >> 'cannot read subclass of metaclass') |
|
214 |
" |
|
215 |
! |
|
216 |
||
217 |
>> aString |
|
218 |
"create and return a new UserMessage, with the receiver as key, |
|
219 |
and the argument as defaultString. |
|
220 |
VW compatibility." |
|
221 |
||
222 |
^ UserMessage key:self defaultString:aString |
|
223 |
||
224 |
" |
|
225 |
(#theFooMessage << #myMessages) |
|
226 |
(#theFooMessage << #myMessages >> 'cannot read subclass of metaclass') |
|
227 |
(#theFooMessage >> 'cannot read subclass of metaclass') |
|
228 |
" |
|
229 |
! ! |
|
230 |
||
1 | 231 |
!Symbol methodsFor:'accessing'! |
232 |
||
233 |
basicAt:index put:something |
|
345 | 234 |
"report an error if an interned symbol is about to be changed |
1219 | 235 |
- interned symbols may NOT be changed. |
236 |
For uninterned symbols, this is allowed." |
|
1 | 237 |
|
77 | 238 |
self knownAsSymbol ifTrue:[ |
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
239 |
self error:'interned symbols may not be changed'. |
77 | 240 |
]. |
241 |
" |
|
242 |
uninterned - allow change |
|
243 |
" |
|
244 |
^ super basicAt:index put:something |
|
1219 | 245 |
|
246 |
"Modified: 19.4.1996 / 11:16:10 / cg" |
|
1 | 247 |
! ! |
248 |
||
3086 | 249 |
|
608 | 250 |
!Symbol methodsFor:'comparing'! |
159 | 251 |
|
608 | 252 |
= something |
253 |
"return true, if the receiver and argument consist of the same characters. |
|
254 |
Redefined here, for more efficient #= comparison of symbols |
|
255 |
(which ought to be compared using #==). |
|
256 |
If the argument is a symbol, we use a quick pointer compare, instead of |
|
257 |
the inherited value compare." |
|
13 | 258 |
|
608 | 259 |
%{ /* NOCONTEXT */ |
260 |
OBJ cls; |
|
13 | 261 |
|
608 | 262 |
if (! __isNonNilObject(something)) RETURN(false); |
263 |
if ((cls = __qClass(something)) == Symbol) { |
|
264 |
RETURN (self == something ? true : false); |
|
265 |
} |
|
266 |
if (cls == String) { |
|
267 |
RETURN (strcmp(__stringVal(self), __stringVal(something)) == 0 ? true : false); |
|
345 | 268 |
} |
269 |
%}. |
|
608 | 270 |
"fall back; could be a TwoByteString, or a collection of Characters" |
1 | 271 |
|
608 | 272 |
^ super = something |
427 | 273 |
! |
274 |
||
356 | 275 |
identityHash |
276 |
"interned symbols can return a better hash key" |
|
277 |
||
278 |
%{ /* NOCONTEXT */ |
|
279 |
||
8913 | 280 |
REGISTER unsigned INT g, val; |
3985 | 281 |
REGISTER unsigned char *cp, *ce; |
356 | 282 |
int l; |
283 |
||
284 |
if (__Class(self) == Symbol) { |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
285 |
val = __GET_HASH(self); |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
286 |
/* |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
287 |
* only do it, if I have no standard hash key |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
288 |
* assigned (which can only happen due to a #become:, |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
289 |
* or by creating a symbol uninterned, and interning it |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
290 |
* after it got a hashKey assigned. |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
291 |
*/ |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
292 |
if (val == 0) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
293 |
cp = __stringVal(self); |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
294 |
l = __stringSize(self); |
356 | 295 |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
296 |
/* |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
297 |
* this is the dragon-book algorithm |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
298 |
* We have tested 5-bit shifts as well: |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
299 |
* |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
300 |
* ST/X Symbols: 17807 |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
301 |
* Hashkey collisions (4bit): 14 0.07% |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
302 |
* Hashkey collisions (5bit): 300 1.68% |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
303 |
*/ |
356 | 304 |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
305 |
if (l > 0) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
306 |
val = cp[0]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
307 |
if (l > 1) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
308 |
val = (val << 4) + cp[1]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
309 |
if (l > 2) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
310 |
val = (val << 4) + cp[2]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
311 |
if (l > 3) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
312 |
val = (val << 4) + cp[3]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
313 |
if (l > 4) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
314 |
val = (val << 4) + cp[4]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
315 |
if (l > 5) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
316 |
val = (val << 4) + cp[5]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
317 |
if (l > 6) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
318 |
val = (val << 4) + cp[6]; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
319 |
for (ce = cp + l, cp += 7; cp < ce; cp++) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
320 |
if (g = (val & 0xF0000000)) { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
321 |
val ^= g >> 24; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
322 |
val ^= g; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
323 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
324 |
val = (val << 4) + *cp; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
325 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
326 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
327 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
328 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
329 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
330 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
331 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
332 |
} else { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
333 |
val = 0; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
334 |
} |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
335 |
val = (val * 31415821) & 0x3fffffff; |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
336 |
} else { |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
337 |
val = __MAKE_HASH__(val); |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
338 |
} |
8913 | 339 |
RETURN ( __mkSmallInteger(val) ); |
356 | 340 |
} |
341 |
%}. |
|
342 |
^ super identityHash |
|
3985 | 343 |
|
344 |
" |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
345 |
|hashColl hashSet| |
3985 | 346 |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
347 |
hashColl := OrderedCollection new:20000. |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
348 |
Symbol allInstancesDo:[:instance | |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
349 |
hashColl add:instance identityHash |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
350 |
]. |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
351 |
hashSet := hashColl asSet. |
3985 | 352 |
|
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
353 |
Transcript showCR:'Symbols: ', hashColl size printString, |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
354 |
' unique hash keys: ', hashSet size printString, |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
355 |
' collisions:', (hashColl size - hashSet size) printString. |
3985 | 356 |
" |
357 |
||
370 | 358 |
! |
359 |
||
360 |
~= something |
|
361 |
"return true, if the receiver and argument do not consist of the same characters. |
|
362 |
Redefined here, for more efficient #~= comparison of symbols |
|
363 |
(which ought to be compared using #~~). |
|
364 |
If the argument is a symbol, we use a quick pointer compare, instead of |
|
365 |
the inherited value compare." |
|
366 |
||
367 |
%{ /* NOCONTEXT */ |
|
368 |
OBJ cls; |
|
369 |
||
379 | 370 |
if (! __isNonNilObject(something)) RETURN(true); /* cannot be equal */ |
370 | 371 |
if ((cls = __qClass(something)) == Symbol) { |
379 | 372 |
RETURN (self == something ? false : true); |
370 | 373 |
} |
374 |
if (cls == String) { |
|
379 | 375 |
RETURN (strcmp(__stringVal(self), __stringVal(something)) == 0 ? false : true); |
370 | 376 |
} |
377 |
%}. |
|
378 |
"fall back; could be a TwoByteString, or a collection of Characters" |
|
379 |
||
380 |
^ super ~= something |
|
356 | 381 |
! ! |
382 |
||
608 | 383 |
!Symbol methodsFor:'converting'! |
384 |
||
385 |
asString |
|
386 |
"return a string with printname taken from mine" |
|
387 |
||
388 |
%{ /* NOCONTEXT */ |
|
389 |
OBJ s; |
|
390 |
||
2565 | 391 |
s = __MKSTRING_ST(self); |
608 | 392 |
if (s != nil) { |
5434 | 393 |
RETURN (s); |
608 | 394 |
} |
395 |
%}. |
|
5434 | 396 |
^ (String new:(self size)) |
397 |
replaceFrom:1 with:self startingAt:1 |
|
608 | 398 |
! |
399 |
||
400 |
asSymbol |
|
9231 | 401 |
"Return a unique symbol with the name taken from the receivers characters. |
608 | 402 |
Since I am a symbol - just return myself" |
403 |
||
404 |
^ self |
|
405 |
! |
|
406 |
||
407 |
asSymbolIfInterned |
|
9231 | 408 |
"If a symbol with the receivers characters is already known, return it. Otherwise, return nil. |
608 | 409 |
Since I am a symbol - just return myself" |
410 |
||
411 |
^ self |
|
412 |
! ! |
|
413 |
||
414 |
!Symbol methodsFor:'copying'! |
|
415 |
||
416 |
copy |
|
417 |
"return a copy of myself |
|
4729 | 418 |
- reimplemented here since symbols are immutable." |
608 | 419 |
|
420 |
^ self |
|
421 |
! |
|
422 |
||
3659 | 423 |
copyReplaceAll:oldElement with:newElement |
424 |
"return a copy of the receiver as a string, where all elements equal to oldElement |
|
425 |
have been replaced by newElement." |
|
426 |
||
6054
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
427 |
"/ 'Warning: #copyReplaceAll:with: will change semantics as defined in ANSI soon' errorPrintCR. |
3659 | 428 |
^ self asString replaceAll:oldElement with:newElement |
429 |
||
430 |
"Created: / 18.7.1998 / 23:03:38 / cg" |
|
431 |
! |
|
432 |
||
6054
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
433 |
copyReplacing:oldElement withObject:newElement |
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
434 |
"return a copy of the receiver, where all elements equal to oldElement |
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
435 |
have been replaced by newElement. |
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
436 |
ANSI version of what used to be #copyReplaceAll:with:" |
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
437 |
|
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
438 |
^ self asString replaceAll:oldElement with:newElement |
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
439 |
! |
7719f857af51
added #copyReplacing:withObject: (ANSI)
Claus Gittinger <cg@exept.de>
parents:
6001
diff
changeset
|
440 |
|
608 | 441 |
deepCopy |
442 |
"return a copy of myself |
|
4729 | 443 |
- reimplemented here since symbols are immutable." |
608 | 444 |
|
445 |
^ self |
|
446 |
! |
|
447 |
||
10950 | 448 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8383 | 449 |
"return a deep copy of myself |
4729 | 450 |
- reimplemented here since symbols are immutable." |
608 | 451 |
|
452 |
^ self |
|
453 |
! |
|
454 |
||
455 |
shallowCopy |
|
456 |
"return a copy of myself |
|
10581 | 457 |
- reimplemented here since symbols are immutable and unique, |
458 |
so we return the receiver." |
|
608 | 459 |
|
460 |
^ self |
|
10581 | 461 |
|
462 |
"Modified: / 31-05-2007 / 15:32:30 / cg" |
|
608 | 463 |
! |
464 |
||
465 |
simpleDeepCopy |
|
466 |
"return a copy of myself |
|
4729 | 467 |
- reimplemented here since symbols are immutable." |
608 | 468 |
|
469 |
^ self |
|
470 |
! ! |
|
471 |
||
472 |
!Symbol methodsFor:'printing & storing'! |
|
473 |
||
474 |
displayString |
|
11773 | 475 |
"return a string for displaying the receiver in a view (inspector)" |
608 | 476 |
|
477 |
^ self storeString |
|
478 |
! |
|
479 |
||
480 |
printOn:aStream |
|
4392 | 481 |
"append a user printed representation of the receiver to aStream. |
482 |
The format is suitable for a human - not meant to be read back. |
|
483 |
||
608 | 484 |
In contrast to ST-80, this does return the symbols characters |
485 |
without any leading #. Therefore, you can directly send symbols' |
|
486 |
printStrings to some output device. This is incompatible, but easier |
|
487 |
to use." |
|
488 |
||
489 |
"/ ST-80 behavior: |
|
490 |
||
491 |
"/ self storeOn:aStream |
|
492 |
||
493 |
aStream nextPutAll:self |
|
494 |
! |
|
495 |
||
496 |
printString |
|
497 |
"return a printed representation of the receiver. |
|
498 |
In contrast to ST-80, this does return the symbols characters |
|
499 |
without any leading #. Therefore, you can directly send symbols' |
|
500 |
printStrings to some output device. This is incompatible, but easier |
|
501 |
to use." |
|
502 |
||
503 |
"/ ST-80 behavior: |
|
504 |
"/ ^ self storeString |
|
505 |
||
506 |
^ self asString |
|
507 |
! |
|
508 |
||
7600
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
509 |
storeArrayElementOn:aStream |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
510 |
"store myself on a stream. |
8368 | 511 |
I am stored as an array element, so the '#' may be omitted sometimes. |
7600
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
512 |
Take care for special symbols" |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
513 |
|
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
514 |
|storeString| |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
515 |
|
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
516 |
storeString := self storeString. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
517 |
(self == #true or:[self == #false or:[self == #nil or:[(storeString at:2) == $']]]) ifTrue:[ |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
518 |
aStream nextPutAll:storeString. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
519 |
] ifFalse:[ |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
520 |
aStream nextPutAll:self. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
521 |
]. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
522 |
! |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
523 |
|
608 | 524 |
storeOn:aStream |
525 |
"store myself on a stream" |
|
526 |
||
527 |
aStream nextPutAll:(self storeString) |
|
528 |
! |
|
529 |
||
530 |
storeString |
|
531 |
"return a String for storing the receiver" |
|
532 |
||
4098 | 533 |
|sz "{Class: SmallInteger }" |
5941
e194c325bee8
storeString fixed for symbols like #'foo:bar'
Claus Gittinger <cg@exept.de>
parents:
5896
diff
changeset
|
534 |
c anyColon| |
1125 | 535 |
|
7600
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
536 |
sz := self size. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
537 |
(sz ~~ 0 and:[(self at:1) isLetter]) ifTrue:[ |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
538 |
anyColon := false. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
539 |
2 to:sz do:[:index | |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
540 |
c := self at:index. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
541 |
c == $: ifTrue:[ |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
542 |
(index == sz or:[(self at:(index+1)) isLetterOrDigit]) ifFalse:[ |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
543 |
^ '#' , super storeString. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
544 |
]. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
545 |
anyColon := true. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
546 |
] ifFalse:[ |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
547 |
c isLetterOrDigit ifFalse:[ |
5185
15a129151b3b
fixed bug in storeString (must duplicate single quotes)
Claus Gittinger <cg@exept.de>
parents:
4987
diff
changeset
|
548 |
^ '#' , super storeString |
15a129151b3b
fixed bug in storeString (must duplicate single quotes)
Claus Gittinger <cg@exept.de>
parents:
4987
diff
changeset
|
549 |
]. |
15a129151b3b
fixed bug in storeString (must duplicate single quotes)
Claus Gittinger <cg@exept.de>
parents:
4987
diff
changeset
|
550 |
]. |
7600
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
551 |
]. |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
552 |
"no colon in symbol or symbol ends with a colon" |
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
553 |
(anyColon and:[c ~~ $:]) ifFalse:[ |
5185
15a129151b3b
fixed bug in storeString (must duplicate single quotes)
Claus Gittinger <cg@exept.de>
parents:
4987
diff
changeset
|
554 |
^ '#' , self |
7600
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
555 |
]. |
608 | 556 |
]. |
5896 | 557 |
^ '#' , super storeString |
3285
bd5827c97b21
Do not need quotes in #storeString when a symbol contains a ':'.
Stefan Vogel <sv@exept.de>
parents:
3086
diff
changeset
|
558 |
|
3286
c6987c5f15a8
Do not need quotes in #storeString when a symbol contains a ':'.
Stefan Vogel <sv@exept.de>
parents:
3285
diff
changeset
|
559 |
" |
5896 | 560 |
#'abc' storeString |
561 |
#'abc:' storeString |
|
562 |
#'abc:def:' storeString |
|
4098 | 563 |
#'abc:def' storeString |
5896 | 564 |
#'abc::def' storeString |
565 |
#'abc &^*' storeString |
|
566 |
#'abcdef::' storeString |
|
567 |
#'hello''world' storeString |
|
568 |
#'' storeString |
|
569 |
#'''' storeString |
|
5185
15a129151b3b
fixed bug in storeString (must duplicate single quotes)
Claus Gittinger <cg@exept.de>
parents:
4987
diff
changeset
|
570 |
#'_hello' storeString |
7600
5a3fee21c032
#storeString - omit # from Symbols and Arrays that are elements of an array.
Stefan Vogel <sv@exept.de>
parents:
7350
diff
changeset
|
571 |
#'123' storeString |
3286
c6987c5f15a8
Do not need quotes in #storeString when a symbol contains a ':'.
Stefan Vogel <sv@exept.de>
parents:
3285
diff
changeset
|
572 |
" |
608 | 573 |
! ! |
574 |
||
575 |
!Symbol methodsFor:'queries'! |
|
576 |
||
4987 | 577 |
isInfix |
578 |
"return true, if the receiver is a binary message selector" |
|
579 |
||
7350
a62d53937a6b
ansified (isAlphaNumeric -> isLetterOrDigit)
Claus Gittinger <cg@exept.de>
parents:
7301
diff
changeset
|
580 |
^ self first isLetterOrDigit not |
4987 | 581 |
|
582 |
" |
|
583 |
#at:put: isInfix |
|
584 |
#at: isInfix |
|
585 |
#+ isInfix |
|
586 |
#size isInfix |
|
587 |
" |
|
588 |
||
589 |
"Created: / 1.11.1997 / 12:34:55 / cg" |
|
590 |
"Modified: / 1.11.1997 / 12:36:37 / cg" |
|
591 |
! |
|
592 |
||
3086 | 593 |
isKeyword |
594 |
"return true, if the receiver is a keyword message selector" |
|
595 |
||
596 |
^ self includes:$: |
|
597 |
||
598 |
" |
|
599 |
#at:put: isKeyword |
|
600 |
#at: isKeyword |
|
601 |
#+ isKeyword |
|
602 |
#size isKeyword |
|
603 |
" |
|
604 |
||
605 |
"Created: / 1.11.1997 / 12:34:55 / cg" |
|
606 |
"Modified: / 1.11.1997 / 12:36:37 / cg" |
|
607 |
! |
|
608 |
||
608 | 609 |
isSymbol |
610 |
"return true, if the receiver is some kind of symbol. |
|
611 |
Since I am a symbol, return always true" |
|
612 |
||
613 |
^ true |
|
614 |
! |
|
615 |
||
616 |
keywords |
|
617 |
"assuming the receiver is a keyword message selector, |
|
618 |
return the individual keywords (i.e. break it up at colons) |
|
619 |
and return these as a collection. |
|
620 |
For binary and unary selectors, the result may be nonsense." |
|
621 |
||
622 |
|coll s part| |
|
623 |
||
624 |
coll := OrderedCollection new. |
|
625 |
s := ReadStream on:self. |
|
626 |
[s atEnd] whileFalse:[ |
|
627 |
part := s through:$:. |
|
628 |
coll add:part |
|
629 |
]. |
|
630 |
^ coll asArray |
|
631 |
||
632 |
" |
|
633 |
#at:put: keywords |
|
634 |
#at: keywords |
|
635 |
#+ keywords |
|
636 |
#size keywords |
|
637 |
" |
|
638 |
! |
|
639 |
||
640 |
species |
|
641 |
"when copying, or concatenating, return instances of this class" |
|
642 |
||
643 |
^ String |
|
644 |
! ! |
|
645 |
||
77 | 646 |
!Symbol methodsFor:'system primitives'! |
647 |
||
648 |
become:anotherObject |
|
649 |
"make all references to the receiver become references to anotherObject |
|
95 | 650 |
and vice-versa. For symbols, some special action is required, to |
651 |
correctly handle a become of the global dictionaries. |
|
77 | 652 |
Anyway: this is very dangerous - mysterous side-effects are to be |
95 | 653 |
expected. |
654 |
||
655 |
Notice: because of the danger here, this method may report an error |
|
159 | 656 |
in future versions" |
77 | 657 |
|
658 |
(Smalltalk includesKey:self) ifTrue:[ |
|
159 | 659 |
super become:anotherObject. |
77 | 660 |
%{ |
159 | 661 |
__rehashSystemDictionaries(); |
77 | 662 |
%}. |
663 |
] ifFalse:[ |
|
159 | 664 |
super become:anotherObject |
77 | 665 |
] |
666 |
! |
|
667 |
||
668 |
becomeNil |
|
669 |
"make all references to the receiver become nil - effectively getting |
|
95 | 670 |
rid of the receiver. For symbols, this is not allowed, if the receiver |
7765 | 671 |
is used as a key in some SystemDictionary. |
95 | 672 |
This can be a very dangerous operation - be warned. |
673 |
||
674 |
Notice: because of the danger here, this method may report an error |
|
7765 | 675 |
in future versions" |
77 | 676 |
|
677 |
(Smalltalk includesKey:self) ifTrue:[ |
|
7765 | 678 |
self primitiveFailed |
77 | 679 |
] ifFalse:[ |
7765 | 680 |
super becomeNil |
77 | 681 |
] |
682 |
! ! |
|
683 |
||
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
684 |
!Symbol methodsFor:'tracing'! |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
685 |
|
4682 | 686 |
traceInto:aRequestor level:level from:referrer |
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
687 |
"double dispatch into tracer, passing my type implicitely in the selector" |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
688 |
|
4682 | 689 |
^ aRequestor traceSymbol:self level:level from:referrer |
4651
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
690 |
|
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
691 |
|
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
692 |
! ! |
18a6ac30b36f
added #hasSharedInstances & tracing support
Claus Gittinger <cg@exept.de>
parents:
4530
diff
changeset
|
693 |
|
8395
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
694 |
!Symbol methodsFor:'visiting'! |
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
695 |
|
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
696 |
acceptVisitor:aVisitor with:aParameter |
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
697 |
|
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
698 |
^ aVisitor visitSymbol:self with:aParameter |
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
699 |
! ! |
6bd97113cb4c
Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents:
8383
diff
changeset
|
700 |
|
632 | 701 |
!Symbol class methodsFor:'documentation'! |
702 |
||
703 |
version |
|
11819 | 704 |
^ '$Header: /cvs/stx/stx/libbasic/Symbol.st,v 1.87 2009-07-30 08:03:40 cg Exp $' |
632 | 705 |
! ! |