"Why Pascal is Not My Favorite Programming Language" was written in 1981 and the criticisms are out of date. Pascal has moved on since then. Try FreePascal (with Lazarus) or try Delphi.
So... just like most people's criticisms of C++ then?
Contrary to popular belief, C++ does not have very many aspects that should be avoided.
Most of the things to avoid come from C, eg. C memory management (especially C strings), uninitialized variables/memory, etc.
Those who complain that C++ is too complicated, do not understand how computers actually work. If they did, they would know why C++ is the way it is, and would know how to use it. They would also know why most other languages should be considered inferior. Instead, they display their own ignorance.
Yep. Computer languages are a means to an end - they let you turn ideas and algorithms into code.
C++ is king of that, there's no computing concept it can't express. Attacking it becasue of syntax (or whatever) is completely missing the point.
eg. Java didn't have operator overloading because it could be abused. Coding anything mathematical in Java was an exercise in frustration as a direct result of making Java "safe".
Performance-wise, compiled JS is pretty good these days.
True, but: a) To get that performance you have to try and program using as few dynamic features as possible.
b) The expressiveness of the language is terrible: Inheritance and code-re-use is non-existent ("prototype"? LOL!), building proper data structures in Javascript is impossible, at the end of the day everything devolves to closures and there's nothing maintainable or readable about that.
Go search for "douglas crockford javascript" on youtube and see how many knots he ties the language in towards the end. He keeps using the word "elegant" but it's not true.
The fact that people tried to use it for enterprise code was mostly down to Sun's aggressive marketing, not because Java was designed for it (or even suitable).
I would believe that. There's about two dozen ways to iterate through an STL vector class; by integer index, by iterator begin/end, by auto iterator by value, by auto iterator by reference, these can be done backwards from end to start as well. Another combination is whether to pre-increment or post-increment
Yes, but these days we just type:
for (auto& i: mycontainer) { }
And a lot of things you mention weren't ever supposed to be used for iterating. eg. Integer index is there for random access, not iterating. Integer index can't be removed from the language but if you use it for iterating then you're doing it wrong.
I'm not sure about the word "kludge" but yes, compatibility with C is both what made C++ successful and where most of the warts came from.
But most of those complaints are only syntax. You can get used to any syntax. The real problems in programming languages come when they're too limited and don't allow you to express your ideas in code. That's when the real kludges are created - when some legacy app hits a brick wall and goes into a downward spiral of bad code due to limitations of the language. I've not seen it happen in C++.
(mostly because the people behind C++ were computer scientists, not a bunch of hackerclowns, eg. PHP)
Each job requires a slightly different subset, yes.
There's not much you could take out of C++ without harming it in some way, every feature is needed in some circumstance or other.
The only completely useless feature I con think of is C++ arrays - new[] and delete[] don't do anything that can't be done much better with std::vector.
(nb. Arrays were added before templates so that's why they're there)
There's also a bunch of small tweaks that could make it better, eg. require {} on all code blocks.
The idea of programming as a semiskilled task, practiced by people with a few months' training, is dangerous. We wouldn't tolerate plumbers or accountants that poorly educated. We don't have as an aim that architecture (of buildings) and engineering (of bridges and trains) should become more accessible to people with progressively less training. Indeed, one serious problem is that currently, too many software developers are undereducated and undertrained. Obviously, we don't want our tools--including our programming languages--to be more complex than necessary. But one aim should be to make tools that will serve skilled professionals--not to lower the level of expressiveness to serve people who can hardly understand the problems, let alone express solutions. We can and do build tools that make simple tasks simple for more people, but let's not let most people loose on the infrastructure of our technical civilization or force the professionals to use only tools designed for amateurs.
Keep the compiler, keep all the powerful capabilities of C++, and add an alternative syntax - a friendlier one - that people who struggle with C++ can more easily learn and more easily manage
Yes. Even Bjarne said (something like): "Inside C++ is a smaller, cleaner language trying to get out".
The trick is to learn what to use and what not to use.
The main problems C++ has are: a) It's hard to learn C++ by hacking away at it. Some things are counter-intuitive, a good C++ mentor can save you years. b) It's not a platform. Casual programmers don't want a "language", they want a platform.
The bottom line is this though: C++ allows you to precisely express anything you want to do. You never hit a brick wall like you do in other languages.
Also: Garbage collection is a red herring. Nobody manages RAM in C++ because C++ understands RAII like no other language. All the garbage collected languages handle RAM OK but RAM is only one type of resource. You end up explicitly closing files, etc., when you finish with them. In practice, GC actually creates more work for you compared to C++.
Yes, we get it. Basement dwellers don't see the electricity savings from DST and the ability for people to go outdoors and work early in the morning.
And yes, there is a smaller and more elegant language inside C++ screaming to get out. It's called "C".
Especially C string handling, that's really elegant.
C arrays, too. Data structures that don't know how many elements they contain are awesome! Give me more of those....
Data abstraction? A piece of elegant cake in C. Take a look at the OpenSL ES library for an example of an easy to use library written in C.
And minor things like there being no nice way to break out of a deeply nested set of functions, cleaning up as you go.
(eg. An unexpected end of file inside a file parser).
"Why Pascal is Not My Favorite Programming Language" was written in 1981 and the criticisms are out of date. Pascal has moved on since then. Try FreePascal (with Lazarus) or try Delphi.
So... just like most people's criticisms of C++ then?
C++ has moved since the 1990s, too.
Did the OP type "Modula-2"? I must have missed that.
Contrary to popular belief, C++ does not have very many aspects that should be avoided.
Most of the things to avoid come from C, eg. C memory management (especially C strings), uninitialized variables/memory, etc.
Those who complain that C++ is too complicated, do not understand how computers actually work. If they did, they would know why C++ is the way it is, and would know how to use it. They would also know why most other languages should be considered inferior. Instead, they display their own ignorance.
Yep. Computer languages are a means to an end - they let you turn ideas and algorithms into code.
C++ is king of that, there's no computing concept it can't express. Attacking it becasue of syntax (or whatever) is completely missing the point.
eg. Java didn't have operator overloading because it could be abused. Coding anything mathematical in Java was an exercise in frustration as a direct result of making Java "safe".
You need someone that can slap a contact form on a site without breaking anything else or creating a gaping security problem.
It only took you four lines of rant to implode your own argument.
Performance-wise, compiled JS is pretty good these days.
True, but:
a) To get that performance you have to try and program using as few dynamic features as possible.
b) The expressiveness of the language is terrible: Inheritance and code-re-use is non-existent ("prototype"? LOL!), building proper data structures in Javascript is impossible, at the end of the day everything devolves to closures and there's nothing maintainable or readable about that.
Go search for "douglas crockford javascript" on youtube and see how many knots he ties the language in towards the end. He keeps using the word "elegant" but it's not true.
Java has some nice advantages in terms of not caring whether you're running on x86-64 or POWER10 or ARM.
Neither does C++.
If you are writing enterprise scale code in Java, then you are wasting a lot of compute power.
I assure you that enterprises don't care about that.
The point of Java was not to make performant code easier to write, but to make code more maintainable.
No, Java was designed for embedded code in interactive TV sets:
https://en.wikipedia.org/wiki/...
The fact that people tried to use it for enterprise code was mostly down to Sun's aggressive marketing, not because Java was designed for it (or even suitable).
I would believe that. There's about two dozen ways to iterate through an STL vector class; by integer index, by iterator begin/end, by auto iterator by value, by auto iterator by reference, these can be done backwards from end to start as well. Another combination is whether to pre-increment or post-increment
Yes, but these days we just type:
for (auto& i: mycontainer) {
}
And a lot of things you mention weren't ever supposed to be used for iterating. eg. Integer index is there for random access, not iterating. Integer index can't be removed from the language but if you use it for iterating then you're doing it wrong.
new[] and delete[] don't do anything that can't be done much better with std::vector.
Well, they can be used to implement std::vector.
So can malloc().
I'm not sure about the word "kludge" but yes, compatibility with C is both what made C++ successful and where most of the warts came from.
But most of those complaints are only syntax. You can get used to any syntax. The real problems in programming languages come when they're too limited and don't allow you to express your ideas in code. That's when the real kludges are created - when some legacy app hits a brick wall and goes into a downward spiral of bad code due to limitations of the language. I've not seen it happen in C++.
(mostly because the people behind C++ were computer scientists, not a bunch of hackerclowns, eg. PHP)
Nope, C++ was designed to be a practical language every step of the way.
Most of the other languages you mention really were experiments that got way out of hand, especially Pascal and Java.
ref: http://www.cs.virginia.edu/~ev...
Each job requires a slightly different subset, yes.
There's not much you could take out of C++ without harming it in some way, every feature is needed in some circumstance or other.
The only completely useless feature I con think of is C++ arrays - new[] and delete[] don't do anything that can't be done much better with std::vector.
(nb. Arrays were added before templates so that's why they're there)
There's also a bunch of small tweaks that could make it better, eg. require {} on all code blocks.
The idea of programming as a semiskilled task, practiced by people with a few months' training, is dangerous. We wouldn't tolerate plumbers or accountants that poorly educated. We don't have as an aim that architecture (of buildings) and engineering (of bridges and trains) should become more accessible to people with progressively less training. Indeed, one serious problem is that currently, too many software developers are undereducated and undertrained. Obviously, we don't want our tools--including our programming languages--to be more complex than necessary. But one aim should be to make tools that will serve skilled professionals--not to lower the level of expressiveness to serve people who can hardly understand the problems, let alone express solutions. We can and do build tools that make simple tasks simple for more people, but let's not let most people loose on the infrastructure of our technical civilization or force the professionals to use only tools designed for amateurs.
- Bjarne S.
It's not any simpler than C++ though. Right now it's probably still more productive to learn to use C++ properly.
The word you want is "idioms".
Every language has a set of idioms that works and C++ is no exception.
True, but it's not as horrible as all the other languages.
Keep the compiler, keep all the powerful capabilities of C++, and add an alternative syntax - a friendlier one - that people who struggle with C++ can more easily learn and more easily manage
It already has this, in the newer versions.
eg. The 'auto' keyword.
Last I heard: Unity has finally admitted that C# is no use and they're making a new version of it with no garbage collection or dynamic stuff.
(no word on whether they're going to call it C#++)
Yes. Even Bjarne said (something like): "Inside C++ is a smaller, cleaner language trying to get out".
The trick is to learn what to use and what not to use.
The main problems C++ has are:
a) It's hard to learn C++ by hacking away at it. Some things are counter-intuitive, a good C++ mentor can save you years.
b) It's not a platform. Casual programmers don't want a "language", they want a platform.
The bottom line is this though: C++ allows you to precisely express anything you want to do. You never hit a brick wall like you do in other languages.
Also: Garbage collection is a red herring. Nobody manages RAM in C++ because C++ understands RAII like no other language. All the garbage collected languages handle RAM OK but RAM is only one type of resource. You end up explicitly closing files, etc., when you finish with them. In practice, GC actually creates more work for you compared to C++.
Nope.
People who don't understand C++ are doomed to recreate it, badly.
First of all, the stock price is not directly related to profits.
Unless it's Tesla.
When you're Elon Musk your company's stock price is supposed to be related to profits.
(on Slashdot at least)
Imagine all the pretty messages we could make if we had access to all of Unicode!
Or maybe Apple could start using apostrophes.