ImmutableString.st
author Claus Gittinger <cg@exept.de>
Thu, 05 Nov 2009 15:34:58 +0100
changeset 2236 7f6acc1b9127
parent 1772 782a3e74a69f
child 2238 692e8f538efa
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1998 by eXept Software AG
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
1574
a34e93fcf9ff #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 753
diff changeset
    12
"{ Package: 'stx:libcomp' }"
a34e93fcf9ff #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 753
diff changeset
    13
a34e93fcf9ff #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 753
diff changeset
    14
String variableByteSubclass:#ImmutableString
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'System-Compiler-Support'
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!ImmutableString class methodsFor:'documentation'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 1998 by eXept Software AG
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    By default, string literals in smalltalk are mutable objects. That
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    may lead to some subtle (and hard to find errors), if some method passes
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    a string constant as argument to someone else, who changes the
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    string using at:put: like messages. Since the string object is kept in 
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    the first methods literals, the string constant has now been changed without
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    having the methods sourcecode reflect this. Thus, the method will
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    behave differently from what its source may make you think.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    To help finding this kind of 'feature/bug', the compiler can be
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    configured to create instances of this ImmutableString instead of Strings
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    for string literals. Instances of ImmutableString catch storing accesses and
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    enter the debugger. Although useful, this feature is disabled by default
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    for compatibility to other smalltalk implementations. 
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    (Also, if turned on, this makes inspecting string literals entered in
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
     a workspace somewhat strange: you cannot modify it any longer).
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    Turn the ImmutableString feature on by setting the Parsers class variable
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    'StringsAreImmutable' to true or use the new launchers settings menu.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    [see also:]
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
        ImmutableArray
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
        Parser Scanner
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    [author:]
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
        Claus Gittinger
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
! !
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
!ImmutableString methodsFor:'accessing'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
at:index put:value
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    "Trigger an error if an immutable string is stored into.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
     The store will be performed (for compatibility reasons) if you continue
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
     in the debugger."
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    self notifyStoreError.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    ^ super at:index put:value
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    "Created: / 3.8.1998 / 14:45:14 / cg"
2236
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    80
!
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    81
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    82
basicAt:index put:value
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    83
    "Trigger an error if an immutable string is stored into.
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    84
     The store will be performed (for compatibility reasons) if you continue
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    85
     in the debugger."
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    86
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    87
    self notifyStoreError.
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    88
    ^ super basicAt:index put:value
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    89
! !
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    90
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    91
!ImmutableString methodsFor:'converting'!
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    92
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    93
asImmutableString
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
    94
    ^ self
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
! !
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
!ImmutableString methodsFor:'copying'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
copyEmpty
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "when copying, return a real (mutable) String"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    ^ String new:self size
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    "Created: / 3.8.1998 / 14:46:22 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
copyEmptyAndGrow:size
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    "when copying, return a real (mutable) String"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    ^ String new:size
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    "Created: / 3.8.1998 / 14:46:34 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
postCopy
2236
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   116
    "when copied, make me a real (mutable) String"
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   117
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   118
    self changeClassTo:String.
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   119
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   120
    "Created: / 3.8.1998 / 14:46:45 / cg"
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   121
!
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   122
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   123
postDeepCopy
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    "when copied, make it me a real (mutable) String"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    self changeClassTo:String.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
2236
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   128
    "
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   129
     'foobar' asImmutableString copy          class
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   130
     'foobar' asImmutableString shallowCopy   class
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   131
     'foobar' asImmutableString deepCopy      class
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   132
    "
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
shallowCopy
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    "when copying, return a real (mutable) String"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    |sz|
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    sz := self size.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    ^ (String new:sz) replaceFrom:1 to:sz with:self startingAt:1
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    "Created: / 3.8.1998 / 14:47:00 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
! !
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
!ImmutableString methodsFor:'error handling'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
creator 
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    "find the method that contains me"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
1698
a608470b2c0f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1574
diff changeset
   151
    ^ Method allSubInstances detect:[:aMethod | (aMethod referencesGlobal:self)] ifNone:nil.
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    " 
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
      'hello' creator
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    "
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "Created: / 3.8.1998 / 14:47:19 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
notifyStoreError
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    "a store is attempted - for our convenience, find the method that
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
     contains me, for a nicer error message"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    |creator msg|
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    creator := self creator.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    msg := 'store into/change of literal'.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    creator notNil ifTrue:[
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
        msg := msg , ' (' , creator whoString , ')'
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    ].
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    "
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
     this error is reported on an attempt to store into a literal
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
     string. The literal was created in creator.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
     If you press continue in the debugger, the store will be performed.
1574
a34e93fcf9ff #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 753
diff changeset
   175
     If you don't want this, press abort and check your code.
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
     Storing into literals is VERY VERY bad coding style.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    "
1574
a34e93fcf9ff #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 753
diff changeset
   178
    self error:msg mayProceed:true
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    "Created: / 3.8.1998 / 14:47:45 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
! !
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
!ImmutableString methodsFor:'private'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
species
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    "Copies should be mutable"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    ^ String
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    "Created: / 3.8.1998 / 14:47:58 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
! !
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
!ImmutableString methodsFor:'specials'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
become:anotherObject
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    "trigger an error if I should become something else
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
     (this would be an even more tricky manipulation)"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    self notifyStoreError.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    ^ super become:anotherObject
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    "Created: / 3.8.1998 / 14:48:29 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
becomeNil
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    "trigger an error if I should become nil
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
     (this would be an even more tricky manipulation)"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    self notifyStoreError.
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    ^ super becomeNil
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    "Created: / 3.8.1998 / 14:48:37 / cg"
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
! !
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
!ImmutableString class methodsFor:'documentation'!
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
version
2236
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   218
    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmutableString.st,v 1.5 2009-11-05 14:34:58 cg Exp $'
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   219
!
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   220
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   221
version_CVS
7f6acc1b9127 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1772
diff changeset
   222
    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ImmutableString.st,v 1.5 2009-11-05 14:34:58 cg Exp $'
753
62c045f53129 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
! !