Originally posted by BO$$
View Post
Announcement
Collapse
No announcement yet.
John Carmack's Comments On C/C++
Collapse
X
-
Originally posted by susikala View PostOverall, 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.
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.
Comment
-
@dee
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.)
Comment
-
John Carmack's applauds D language
John Carmack as already said that D is a good language for new code as here:
Originally posted by John Carmack'sUsing D for my daily work is not an option, but I applaud thier inclusion of a "pure" attribute.
But for old code like has John Carmack they are no way to move that is a little too big.
Comment
-
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 CarmackUsing D for my daily work is not an option, but I applaud thier inclusion of a "pure" attribute.
Comment
Comment