[Cuis-dev] String vs Symbol objects

ken.dickey at whidbey.com ken.dickey at whidbey.com
Wed Jul 17 14:49:37 PDT 2024


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

> On Wed, Jul 17, 2024 at 3:50 PM <ken.dickey at whidbey.com> wrote:
> 
>> On 2024-07-17 07:08, 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?
>> 
>> Yes.  For me `str1 ~~ str2` --> true
> 
> Are you executing the three lines one at a time or are you selecting 
> all three and running "Do it"?
> Apparently when they are executed individually, the compiler doesn't 
> optimize to make str1 and str1 refer to the same String in memory.
> But when you run all the lines together, the compiler decides that they 
> can share the object and the assertion fails.

Yep!  Evaluated single lines.

Hey, I don't know it all, either!

Always learning!
-KenD


More information about the Cuis-dev mailing list