Copy a string: Difference between revisions
Content deleted Content added
No edit summary |
added J |
||
Line 250:
In Haskell, every value is immutable, including ''String''s. So one never needs to copy them; references are shared.
=={{header|J}}==
src =: 'hello'
dest =: src
J has copy-on-write semantics. So both <tt>src</tt> and <tt>dest</tt> are references to the same memory, until <tt>src</tt> changes, at which time <tt>dest</tt> gets a copy of the original value of <tt>src</tt>.
=={{header|Java}}==
|