ImmutableString.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 17 Jun 2015 06:22:00 +0100
branchjv
changeset 18487 8735bd9eee2f
parent 18120 e3a375d5f6a8
child 18555 7cc0ec139c8d
permissions -rw-r--r--
Use inlined FNV1a hash for String ...and do not use __symbolHash(). Although currently the VM also uses FNV1a hash for Symbols, the __symbolHash() does not handle properly character with codepoint 0 (because '\0' is used as a string terminator). This causes problems with Unicode16/32Strigs whose version of FNV1a hash is using object size from header to determine string's end. Added Symbol>>hash that actually *uses* the __symbolHash() to make sure it's hash is the the same as used bu the VM. Symbols with zeroes are rare and there's no Unicode16/32Symbol. This commit fixes issue #65.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1998 by eXept Software AG
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
     3
	      All Rights Reserved
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
    12
"{ Package: 'stx:libbasic' }"
8807
606a4ec5b693 #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 3714
diff changeset
    13
17373
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    14
"{ NameSpace: Smalltalk }"
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    15
8807
606a4ec5b693 #notifyStoreError raise error proceedable.
Stefan Vogel <sv@exept.de>
parents: 3714
diff changeset
    16
String variableByteSubclass:#ImmutableString
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'System-Compiler-Support'
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!ImmutableString class methodsFor:'documentation'!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 1998 by eXept Software AG
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
    28
	      All Rights Reserved
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
documentation
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    By default, string literals in smalltalk are mutable objects. That
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    may lead to some subtle (and hard to find errors), if some method passes
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    a string constant as argument to someone else, who changes the
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
    45
    string using at:put: like messages. Since the string object is kept in
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    the first methods literals, the string constant has now been changed without
12464
c0a970ba9175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12457
diff changeset
    47
    having the method's sourcecode reflect this. Thus, the method will
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    behave differently from what its source may make you think.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    To help finding this kind of 'feature/bug', the compiler can be
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    configured to create instances of this ImmutableString instead of Strings
12464
c0a970ba9175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12457
diff changeset
    52
    for literals. Instances of ImmutableString catch storing accesses and
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    enter the debugger. Although useful, this feature is disabled by default
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
    54
    for compatibility to other smalltalk implementations.
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    (Also, if turned on, this makes inspecting string literals entered in
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
     a workspace somewhat strange: you cannot modify it any longer).
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    Turn the ImmutableString feature on by setting the Parsers class variable
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    'StringsAreImmutable' to true or use the new launchers settings menu.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
12471
c6260f85e725 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 12464
diff changeset
    61
c6260f85e725 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 12464
diff changeset
    62
    ATTENTION:
14222
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    63
        there may be still code around which checks for explicit class being String
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    64
        (both in Smalltalk and in primitive code). All code like foo 'class == String'
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    65
        or '__isString()' will not work with ImmutableStrings. Use '__isStringLike()' instead.
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    66
        A somewhat better approach would be to either add a flag to the object (mutability)
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    67
        and check this dynamically (expensive) or to place immutable objects into a readonly
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    68
        memory segment (the good solution). We will eventually implement the second in the future...
12471
c6260f85e725 added: #copyright
Claus Gittinger <cg@exept.de>
parents: 12464
diff changeset
    69
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    [see also:]
14222
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    71
        ImmutableArray
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    72
        Parser Scanner
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    [author:]
14222
876ba773f5d2 changed: #documentation
Stefan Vogel <sv@exept.de>
parents: 14115
diff changeset
    75
        Claus Gittinger
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
! !
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
17373
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    79
!ImmutableString class methodsFor:'queries'!
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    80
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    81
mutableClass
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    82
    "answer an equivalent mustable class"
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    83
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    84
    ^ String
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    85
! !
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    86
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    87
!ImmutableString class methodsFor:'testing'!
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    88
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    89
hasImmutableInstances
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    90
    ^ true
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    91
! !
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
    92
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
!ImmutableString methodsFor:'accessing'!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
    95
at:index put:value
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    "Trigger an error if an immutable string is stored into.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
     The store will be performed (for compatibility reasons) if you continue
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
     in the debugger."
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
    99
12491
d74b78dd478a Raise NoModificationError
Stefan Vogel <sv@exept.de>
parents: 12471
diff changeset
   100
    self noModificationError.
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    ^ super at:index put:value
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    "Created: / 3.8.1998 / 14:45:14 / cg"
12457
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   104
!
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   105
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
   106
basicAt:index put:value
12457
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   107
    "Trigger an error if an immutable string is stored into.
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   108
     The store will be performed (for compatibility reasons) if you continue
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   109
     in the debugger."
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
   110
12491
d74b78dd478a Raise NoModificationError
Stefan Vogel <sv@exept.de>
parents: 12471
diff changeset
   111
    self noModificationError.
12457
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   112
    ^ super basicAt:index put:value
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   113
! !
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   114
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   115
!ImmutableString methodsFor:'converting'!
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   116
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   117
asImmutableString
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   118
    ^ self
16824
d609e592fd2f added asMutableCollection
Claus Gittinger <cg@exept.de>
parents: 16400
diff changeset
   119
!
d609e592fd2f added asMutableCollection
Claus Gittinger <cg@exept.de>
parents: 16400
diff changeset
   120
d609e592fd2f added asMutableCollection
Claus Gittinger <cg@exept.de>
parents: 16400
diff changeset
   121
asMutableCollection
d609e592fd2f added asMutableCollection
Claus Gittinger <cg@exept.de>
parents: 16400
diff changeset
   122
    "return a writable copy of myself"
d609e592fd2f added asMutableCollection
Claus Gittinger <cg@exept.de>
parents: 16400
diff changeset
   123
d609e592fd2f added asMutableCollection
Claus Gittinger <cg@exept.de>
parents: 16400
diff changeset
   124
    ^ self copy changeClassTo:String
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
! !
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
!ImmutableString methodsFor:'copying'!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
postCopy
12457
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   130
    "when copied, make me a real (mutable) String"
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   131
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   132
    self changeClassTo:String.
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   133
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   134
    "Created: / 3.8.1998 / 14:46:45 / cg"
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   135
!
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   136
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   137
postDeepCopy
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    "when copied, make it me a real (mutable) String"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    self changeClassTo:String.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
12457
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   142
    "
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   143
     'foobar' asImmutableString copy          class
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   144
     'foobar' asImmutableString shallowCopy   class
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   145
     'foobar' asImmutableString deepCopy      class
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   146
    "
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
shallowCopy
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    "when copying, return a real (mutable) String"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    |sz|
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    sz := self size.
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    ^ (String new:sz) replaceFrom:1 to:sz with:self startingAt:1
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
14115
8599762e8a45 comment/format in: #shallowCopy
Stefan Vogel <sv@exept.de>
parents: 14025
diff changeset
   157
    "
8599762e8a45 comment/format in: #shallowCopy
Stefan Vogel <sv@exept.de>
parents: 14025
diff changeset
   158
     'hello world' asImmutableString shallowCopy
8599762e8a45 comment/format in: #shallowCopy
Stefan Vogel <sv@exept.de>
parents: 14025
diff changeset
   159
    "
8599762e8a45 comment/format in: #shallowCopy
Stefan Vogel <sv@exept.de>
parents: 14025
diff changeset
   160
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    "Created: / 3.8.1998 / 14:47:00 / cg"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
! !
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
!ImmutableString methodsFor:'private'!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
species
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    "Copies should be mutable"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    ^ String
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    "Created: / 3.8.1998 / 14:47:58 / cg"
16400
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   172
!
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   173
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   174
speciesForCopy
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   175
    "Copies should be mutable"
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   176
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   177
    ^ String
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   178
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   179
    "Created: / 3.8.1998 / 14:47:58 / cg"
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
! !
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
14386
27b494f48340 isImmutable
Claus Gittinger <cg@exept.de>
parents: 14222
diff changeset
   182
!ImmutableString methodsFor:'queries'!
27b494f48340 isImmutable
Claus Gittinger <cg@exept.de>
parents: 14222
diff changeset
   183
27b494f48340 isImmutable
Claus Gittinger <cg@exept.de>
parents: 14222
diff changeset
   184
isImmutable
27b494f48340 isImmutable
Claus Gittinger <cg@exept.de>
parents: 14222
diff changeset
   185
    ^ true
27b494f48340 isImmutable
Claus Gittinger <cg@exept.de>
parents: 14222
diff changeset
   186
! !
27b494f48340 isImmutable
Claus Gittinger <cg@exept.de>
parents: 14222
diff changeset
   187
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
!ImmutableString methodsFor:'specials'!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
   190
become:anotherObject
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "trigger an error if I should become something else
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
     (this would be an even more tricky manipulation)"
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
   193
12491
d74b78dd478a Raise NoModificationError
Stefan Vogel <sv@exept.de>
parents: 12471
diff changeset
   194
    self noModificationError.
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    ^ super become:anotherObject
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    "Created: / 3.8.1998 / 14:48:29 / cg"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
becomeNil
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    "trigger an error if I should become nil
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
     (this would be an even more tricky manipulation)"
12538
e6bf8c42e1d4 Moved to libbasic from libcomp - change package name
Stefan Vogel <sv@exept.de>
parents: 12491
diff changeset
   203
12491
d74b78dd478a Raise NoModificationError
Stefan Vogel <sv@exept.de>
parents: 12471
diff changeset
   204
    self noModificationError.
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    ^ super becomeNil
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    "Created: / 3.8.1998 / 14:48:37 / cg"
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
! !
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
!ImmutableString class methodsFor:'documentation'!
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
version
17373
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
   213
    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableString.st,v 1.16 2015-02-03 13:53:40 stefan Exp $'
12457
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   214
!
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   215
7094a6561516 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9412
diff changeset
   216
version_CVS
17373
2dcc19464bd0 class: ImmutableString
Stefan Vogel <sv@exept.de>
parents: 16824
diff changeset
   217
    ^ '$Header: /cvs/stx/stx/libbasic/ImmutableString.st,v 1.16 2015-02-03 13:53:40 stefan Exp $'
3714
62524619bfb7 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
! !
16400
6c38fd2957bc class: ImmutableString
Claus Gittinger <cg@exept.de>
parents: 14386
diff changeset
   219