[Cuis-dev] String vs Symbol objects

Juan Vuletich juan at cuis.st
Wed Jul 17 08:12:50 PDT 2024


On 7/17/2024 11:08 AM, Mark Volkmann via Cuis-dev wrote:
> When I enter the following lines in a Workspace, select them, and "Do 
> it", I get an AssertionFailure error:
>
> str1 := 'test'.
> str2 := 'test'.
> self assert: str1 ~~ str2.
>
> Ken, are you saying that you do not get that error?
>
> -- 
> R. Mark Volkmann
> Object Computing, Inc.

Side comment: an AssertionFailure is an Exception but not an Error (see 
class hierarchy).

You get the AssertionFailure if you select all three lines and evaluate 
them together, but not if you evaluate them one by one.

Truth is that str1 and str2 can not be assumed to be the same object. 
But they can not be assumed to be different object either. The compiler 
is free to reuse the string if it is easy enough.

Cheers,

-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240717/49488ad9/attachment.htm>


More information about the Cuis-dev mailing list