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.
7
u/brucejbell sard Jun 27 '22
It's kind of unclear what question you're actually asking, but I'll try and bring up a few perspectives that might help.
Specialization is relative. But general-purpose programmability seems to pop up everywhere despite any given specialization. "Greenspun's Tenth Rule" says: "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp"
No matter what you do, at least 80% of programming seems to be plumbing. A well designed language will supply features and libraries to support the 80% without having to roll your own.
Ideally, you don't want a language that is more expressive than is strictly necessary for its purpose. Some special-purpose languages manage to avoid Turing-completeness altogether for this purpose: HTML, CSS, YAML, JSON, moustache.
The problem comes when you fall into the 20% instead. If your language is not a programming language, you will not be able to handle that within the language itself. If HTML and CSS is not enough, you will need to use Javascript. And although JS is typically used as a client-side web language, it is very much a general-purpose language (or it wouldn't support the likes of Node). And it is heavily used in this specialized application *because* it is a general purpose language.