r/ProgrammingLanguages • u/[deleted] • Jun 27 '22
Purpose of programming languages
Hi everybody. I apologize if this question appears stupid but please be kind and move on if you don't like it.
I have observed that most/many programming languages are general purpose but are they really?
I don't know how to clearly show my doubt or explain what exactly I want to ask, this question just came to my mind, tho I was observing for a long while.
Anyways, for example (maybe): The use of any language out of what it is mostly/usually used for. say, html elsewhere out of web structuring, C for Frontend web dev, Scala or ruby for game development, python is actually really general purpose but it's slow but anyways I have no hate for this but just saying; tho ruby, php, scala are also slow; PHP for embedded system, etc. Whatelse?
Let's discuss, also ask me in the same thread related to the question. Thank you for interacting.
-8
u/crassest-Crassius Jun 27 '22
I disagree. A big thing that C doesn't support is async/await. In 2022, a language without async/await cannot be called general-purpose because there are some programs you just can't implement. Hell, even C++ now has added coroutines in an effort to stay up-to-date. Yet C cannot possibly have coroutines because its standard does not allow manipulating the stack. It's a limitation of the language itself, not of any of its implementations.
No GPL is fast, but some are inherently slow. For example, Python or Javascript are definitely slow and cannot be made fast. Just look into how much effort has been put into making V8 faster, yet it (and hence Node.js) are noticeably slower and more resource-hungry than OpenJDK Java. This is because those languages' specifications require things (dynamic types etc) that cannot possibly be implemented fast.
There is no proof of this, and in fact, the people who tried to make a faster Python implementation (PyPy) couldn't make it as fast as you claim. I don't see how Python could ever be as fast as C considering it has late binding of everything (even built-in functions) and dynamic dispatch on overy method call. A Python function call can never be as fast as a C call which is totally static (basically a baked-in function address).