Login  Register

Re: How replace in String works

Posted by GLASS mailing list on Jan 15, 2020; 5:55pm
URL: https://forum.world.st/How-replace-in-String-works-tp5110108p5110112.html

Bruno,

In GemStone, literal strings and array are created invariant. As you
have discovered a copy of the string is not invariant, so if you are
created literal strings  that you intend to modify then you should do
the copy at creation time ...

Dale

On 1/15/20 8:56 AM, BrunoBB via Glass wrote:

> Hi,
> GS 3.4.1
>
> Why:
> '123'  at: 3 put: $4; yourself.        "rise an exception"
> '123' copy at: 3 put: $4; yourself   "works ok"
>
> My problem was using replaceAll:with: but the "culprit" was at:put: in
> Strings.
>
> '123' copy isInvariant "answer false"
> '123' isInvariant "answer true"
>
> regards,
> bruno
>
>
>
> --
> Sent from: http://forum.world.st/GLASS-f1460844.html
> _______________________________________________
> Glass mailing list
> [hidden email]
> https://lists.gemtalksystems.com/mailman/listinfo/glass
_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass