immutable Strings ?

120 views
Skip to first unread message

Diego Javier Zea

unread,
Mar 8, 2013, 8:33:21 PM3/8/13
to juli...@googlegroups.com
Strings are now immutable by convention. Are going to be a immutable type now ?

John Myles White

unread,
Mar 8, 2013, 8:37:22 PM3/8/13
to juli...@googlegroups.com
I'm pretty sure strings were always an immutable type. The new immutable types are special because you can create your own immutable types. Numbers and strings were always immutable as far as I know.

-- John

Stefan Karpinski

unread,
Mar 8, 2013, 8:54:59 PM3/8/13
to Julia Dev
The base string types ASCIIString and UTF8String are actually currently both mutable and the data array that that use to store bytes is mutable as well. However, ASCIIString and UTF8String should both be made immutable. We don't have an immutable array type, so the immutability of the *data* in a string will continue to be a matter of convention, however.

John Myles White

unread,
Mar 8, 2013, 8:57:59 PM3/8/13
to juli...@googlegroups.com
Whoops.  I guess I need to catch up on the Julia world.

 -- John

Stefan Karpinski

unread,
Mar 8, 2013, 9:05:23 PM3/8/13
to Julia Dev
Well, we use the term "immutable" for Julia's strings in a rather different sense than the immutability that was just introduced. They're immutable simply by convention – i.e. we *don't* generally change them – rather than in the sense that it isn't possible within the language to change them. So the confusion is quite understandable.
Reply all
Reply to author
Forward
0 new messages