UnicodeString's and external storage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

UnicodeString's and external storage

Eric Winger-5
Shouldn't the following be valid?

UnicodeString fromAddress: ('hi there' asUnicodeString yourAddress)
String fromAddress: ('hi there' yourAddress)

Evaluating the 2nd works right, but evaluating the first gives me funny
block characters.

thoughts?

Eric


Reply | Threaded
Open this post in threaded view
|

Re: UnicodeString's and external storage

Blair McGlashan
Eric

You wrote in message news:[hidden email]...
> Shouldn't the following be valid?
>
> UnicodeString fromAddress: ('hi there' asUnicodeString yourAddress)
> String fromAddress: ('hi there' yourAddress)
>
> Evaluating the 2nd works right, but evaluating the first gives me funny
> block characters.
>
> thoughts?

Methinks it is the lifetime's of the objects. In the first case you are
taking the address of a 'temporary' object (the result of the
#asUnicodeString message) which is promptly GC'd. In the second case you
have taken the address of a literal, which is not therefore GC'd until the
expression is collected. Judicious use of temporaries will prove it.

Regards

Blair