35 " |
35 " |
36 ! |
36 ! |
37 |
37 |
38 version |
38 version |
39 " |
39 " |
40 $Header: /cvs/stx/stx/libcomp/Attic/ImmArray.st,v 1.5 1995-07-03 02:38:27 claus Exp $ |
40 $Header: /cvs/stx/stx/libcomp/Attic/ImmArray.st,v 1.6 1995-07-23 02:23:34 claus Exp $ |
41 " |
41 " |
42 ! |
42 ! |
43 |
43 |
44 documentation |
44 documentation |
45 " |
45 " |
46 By default, array literals in smalltalk are mutable objects. That |
46 By default, array literals in smalltalk are mutable objects. That |
47 may lead to some subtle (and hard to find errors) if some method passes |
47 may lead to some subtle (and hard to find errors), if some method passes |
48 a literal array constant as argument to someone else, who changes the |
48 a literal array constant as argument to someone else, who changes the |
49 array using at:put: like messages. Since the array object is kept in |
49 array using at:put: like messages. Since the array object is kept in |
50 the first methods literals, the array constant has now been changed without |
50 the first methods literals, the array constant has now been changed without |
51 having the methods sourcecode reflect this. Thus, method the methods will |
51 having the methods sourcecode reflect this. Thus, the method will |
52 behave differently from what its source may make you think. |
52 behave differently from what its source may make you think. |
53 |
53 |
54 To help finding this kind of 'feature/bug', the compiler class can be |
54 To help finding this kind of 'feature/bug', the compiler can be |
55 configured to create instances of this ImmutableArray instead of Arrays |
55 configured to create instances of this ImmutableArray instead of Arrays |
56 for array literals. Instances of ImmutableArray catch storing accesses and |
56 for array literals. Instances of ImmutableArray catch storing accesses and |
57 enter the debugger. Although useful, this feature is disabled by default |
57 enter the debugger. Although useful, this feature is disabled by default |
58 for compatibility to other smalltalk implementations. |
58 for compatibility to other smalltalk implementations. |
59 (Also, if turned on, this makes inspecting array literals entered in |
59 (Also, if turned on, this makes inspecting array literals entered in |
60 a workspace somewhat strange: you cannot modify it any longer). |
60 a workspace somewhat strange: you cannot modify it any longer). |
61 |
61 |
62 Turn the ImmutableArray feature on by setting the Parsers class variable |
62 Turn the ImmutableArray feature on by setting the Parsers class variable |
63 'ArraysAreImmutable' to true. |
63 'ArraysAreImmutable' to true or use the new launchers settings menu. |
64 " |
64 " |
65 ! ! |
65 ! ! |
66 |
66 |
67 !ImmutableArray methodsFor:'error handling'! |
67 !ImmutableArray methodsFor:'error handling'! |
68 |
68 |