If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Sometimes I wonder why don't more people use C# or Java especially since most don't write performance critical code. And since for high frequency trading some companies use Java I think that you can even choose it for performance critical code. So what's not to like? Faster development, less bugs, better debugging.... I think people choose C++ just to show off.

There are many bad or/and lazy Java and C# programers, which write slow and buggy code. I think every programer should know some assembly and C.

Overall, I believe the discussion about which programming language is better and specifically spending time on discussing to which extent constants or likewise should be used or not is pointless. Most programming languages are the same and the differences are mostly, in my opinion, a question of personal preference and a lot of ego.

What I actually think one of the overlooked sides of many languages is intuitivity. If you're already designing a high-level language which is meant to be used by humans, why not do it right? Many languages are just horribly not intuitive in really bad and broken ways and that makes them bad languages. Of course, what is intuitive to one person may be completely arbitrary to someone else and that may be the reason why some languages have made such bad decisions, but take Java for example:

Why should, when considering,String one, two;
// User inputs two strings, both are "number"
This evolve to false?one == two;

In which cases does it make sense to check if two String objects are the same object? In which of the countless cases where a comparison of two strings of characters is involved would you not be interested in testing for character equality? Why should I be forced to use something so ugly as one.equals(two)? That makes absolutely no sense. Of course, if you treat Strings as non-scalars, and if you define the equal operator to work the same on all objects, you could claim you're only being consistent. But is that intuitive? Would someone who learned that 5 == 5 is true ever think that the above example with the strings should evaluate to false? What is the point in deciding to hide away the arraylike/char pointer nature of a C "string" in introducing a proper String object in java, but then keeping the old garbage by forcing you to use an object method for comparison? How dumb is that?

There are similar examples in PHP for why intuitivity is so important, and why lack thereof makes a language so bad.

I think the best way to do it would be this:

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.