This is why I like D. Compared to C++/C#/Java, D gets a lot of things right.http://www.chauqui.info/1.jpghttp://www.chauqui.info/2.jpghttp://www.chauqui.info/3.jpghttp://www.chauqui.info/4.jpghttp://www.chauqui.info/5.jpg
if both string arguments are pooled (ie. immutable) --> compare by reference
if either of the string arguments are not pooled --> compare by character equality
Does any language do it like this, and if not, why? Comparing by reference obviously has a speed benefit, but it's useless when the strings (or one of them) aren't pooled. Conversely, comparing by characters is needless overhead when the strings are pooled. This would to me seem to be the obvious solution.
Don't put immutable with pooled.
You might make someone think pooled means the same as immutable.
(immutable strings can also exist not pooled)
Your point of useless when strings are not pooled is the best point about the string equality checks debate I ever read.
(Same counts for equality of objects though.)
John Carmack as already said that D is a good language for new code as here:
Originally Posted by John Carmack's
But for old code like has John Carmack they are no way to move that is a little too big.
As i already said D is better choice when starting a new code otherwise depend which size is your project.
John Carmack's project are to big to move in another language
Originally Posted by John Carmack