73 " |
73 " |
74 ! ! |
74 ! ! |
75 |
75 |
76 !ImmutableArray methodsFor:'accessing'! |
76 !ImmutableArray methodsFor:'accessing'! |
77 |
77 |
78 at:index put:value |
78 at:index put:value |
79 "Trigger an error if an immutable array is stored into. |
79 "Trigger an error if an immutable array is stored into. |
80 The store will be performed (for compatibility reasons) if you continue |
80 The store will be performed (for compatibility reasons) if you continue |
81 in the debugger." |
81 in the debugger." |
82 |
82 |
83 self notifyStoreError. |
83 self noModificationError. |
84 ^ super at:index put:value |
84 ^ super at:index put:value |
85 |
85 |
86 "Modified: / 3.8.1998 / 14:45:23 / cg" |
86 "Modified: / 3.8.1998 / 14:45:23 / cg" |
87 ! |
87 ! |
88 |
88 |
89 basicAt:index put:value |
89 basicAt:index put:value |
90 "Trigger an error if an immutable array is stored into. |
90 "Trigger an error if an immutable array is stored into. |
91 The store will be performed (for compatibility reasons) if you continue |
91 The store will be performed (for compatibility reasons) if you continue |
92 in the debugger." |
92 in the debugger." |
93 |
93 |
94 self notifyStoreError. |
94 self noModificationError. |
95 ^ super basicAt:index put:value |
95 ^ super basicAt:index put:value |
96 |
96 |
97 "Modified: / 3.8.1998 / 14:45:30 / cg" |
97 "Modified: / 3.8.1998 / 14:45:30 / cg" |
98 ! ! |
98 ! ! |
99 |
99 |
151 " |
151 " |
152 |
152 |
153 "Modified: 24.6.1996 / 15:36:28 / stefan" |
153 "Modified: 24.6.1996 / 15:36:28 / stefan" |
154 ! |
154 ! |
155 |
155 |
156 notifyStoreError |
156 noModificationError |
157 "a store is attempted - for our convenience, find the method that |
157 "a store is attempted - for our convenience, find the method that |
158 contains me, for a nicer error message" |
158 contains me, for a nicer error message" |
159 |
159 |
160 |creator msg| |
160 |creator msg context| |
161 |
161 |
162 creator := self creator. |
162 creator := self creator. |
163 msg := 'store into/change of literal'. |
|
164 creator notNil ifTrue:[ |
163 creator notNil ifTrue:[ |
165 msg := msg , ' (' , creator whoString , ')' |
164 msg := ' (' , creator whoString , ')' |
166 ]. |
165 ]. |
167 " |
166 context := thisContext sender. |
|
167 " |
168 this error is reported on an attempt to store into a literal |
168 this error is reported on an attempt to store into a literal |
169 array. The literal was created in creator. |
169 array. The literal was created in creator. |
170 If you press continue in the debugger, the store will be performed. |
170 If you press continue in the debugger, the store will be performed. |
171 If you don't want this, press abort and check your code. |
171 If you don't want this, press abort and check your code. |
172 Storing into literals is VERY VERY bad coding style. |
172 Storing into literals is VERY VERY bad coding style. |
173 " |
173 " |
174 self error:msg mayProceed:true |
174 NoModificationError |
|
175 raiseRequestWith:self |
|
176 errorString:msg |
|
177 in:context. |
|
178 |
|
179 "Created: / 3.8.1998 / 14:47:45 / cg" |
175 ! ! |
180 ! ! |
176 |
181 |
177 !ImmutableArray methodsFor:'private'! |
182 !ImmutableArray methodsFor:'private'! |
178 |
183 |
179 species |
184 species |
193 |
198 |
194 ! ! |
199 ! ! |
195 |
200 |
196 !ImmutableArray methodsFor:'specials'! |
201 !ImmutableArray methodsFor:'specials'! |
197 |
202 |
198 become:anotherObject |
203 become:anotherObject |
199 "trigger an error if I should become something else |
204 "trigger an error if I should become something else |
200 (this would be an even more tricky manipulation)" |
205 (this would be an even more tricky manipulation)" |
201 |
206 |
202 self notifyStoreError. |
207 self noModificationError. |
203 ^ super become:anotherObject |
208 ^ super become:anotherObject |
204 ! |
209 ! |
205 |
210 |
206 becomeNil |
211 becomeNil |
207 "trigger an error if I should become nil |
212 "trigger an error if I should become nil |
208 (this would be an even more tricky manipulation)" |
213 (this would be an even more tricky manipulation)" |
209 |
214 |
210 self notifyStoreError. |
215 self noModificationError. |
211 ^ super becomeNil |
216 ^ super becomeNil |
212 ! ! |
217 ! ! |
213 |
218 |
214 !ImmutableArray class methodsFor:'documentation'! |
219 !ImmutableArray class methodsFor:'documentation'! |
215 |
220 |
216 version |
221 version |
217 ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.26 2009-11-05 14:42:44 cg Exp $' |
222 ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.27 2009-11-05 17:37:55 stefan Exp $' |
218 ! |
223 ! |
219 |
224 |
220 version_CVS |
225 version_CVS |
221 ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.26 2009-11-05 14:42:44 cg Exp $' |
226 ^ '$Header: /cvs/stx/stx/libbasic/ImmutableArray.st,v 1.27 2009-11-05 17:37:55 stefan Exp $' |
222 ! ! |
227 ! ! |