ImmutableString.st
changeset 12457 7094a6561516
parent 9412 ddccdf467c12
child 12464 c0a970ba9175
--- a/ImmutableString.st	Thu Nov 05 15:34:35 2009 +0100
+++ b/ImmutableString.st	Thu Nov 05 15:34:58 2009 +0100
@@ -9,8 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
-
 "{ Package: 'stx:libcomp' }"
 
 String variableByteSubclass:#ImmutableString
@@ -79,6 +77,21 @@
     ^ super at:index put:value
 
     "Created: / 3.8.1998 / 14:45:14 / cg"
+!
+
+basicAt:index put:value
+    "Trigger an error if an immutable string is stored into.
+     The store will be performed (for compatibility reasons) if you continue
+     in the debugger."
+
+    self notifyStoreError.
+    ^ super basicAt:index put:value
+! !
+
+!ImmutableString methodsFor:'converting'!
+
+asImmutableString
+    ^ self
 ! !
 
 !ImmutableString methodsFor:'copying'!
@@ -100,11 +113,23 @@
 !
 
 postCopy
+    "when copied, make me a real (mutable) String"
+
+    self changeClassTo:String.
+
+    "Created: / 3.8.1998 / 14:46:45 / cg"
+!
+
+postDeepCopy
     "when copied, make it me a real (mutable) String"
 
     self changeClassTo:String.
 
-    "Created: / 3.8.1998 / 14:46:45 / cg"
+    "
+     'foobar' asImmutableString copy          class
+     'foobar' asImmutableString shallowCopy   class
+     'foobar' asImmutableString deepCopy      class
+    "
 !
 
 shallowCopy
@@ -190,5 +215,9 @@
 !ImmutableString class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableString.st,v 1.4 2006-07-03 16:10:23 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableString.st,v 1.5 2009-11-05 14:34:58 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableString.st,v 1.5 2009-11-05 14:34:58 cg Exp $'
 ! !