[Cuis-dev] String vs Symbol objects

ken.dickey at whidbey.com ken.dickey at whidbey.com
Wed Jul 17 07:00:11 PDT 2024


On 2024-07-17 06:24, Mark Volkmann via Cuis-dev wrote:

> I understand that Symbols are globally unique and I thought Strings are 
> not.
> But I'm confused by this code:
..
> str1 := 'test'.
> str2 := 'test'.
> self assert: str1 = str2. "passes"
> self assert: str1 ~~ str2. "FAILS"
> 
> Why does the last line fail?

No idea. Programmer error ?? ;^)

str1 := 'test'.
str2 := 'test'.
self assert: str1 = str2. "passes -- equal characters"
self assert: str1 == str2.  "FAILS -- different memory locations"
self assert: str1 ~~ str2. "passes -- not not-equal"

???
-KenD


More information about the Cuis-dev mailing list