From: Peter Dimov (pdimov_at_[hidden])
Date: 2006-07-06 06:23:05
Martin Wille wrote:
> String handling is the thing Java got basically right, IMHO. Java
> distinguishes between a string class (immutable strings) and a string
> builder class.
They had no choice but to get it right. Java is reference-based and has no
const. The only way to provide value semantics is to make the values
immutable. If they aren't, you have to defensively clone them whenever you
are returning a field (otheriwse the caller may modify your state through
its reference), which is extremely error-prone. They managed to get Date
wrong, though. It's mutable.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk