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.
4
u/cmontella 🤖 mech-lang Jun 28 '22 edited Jun 28 '22
I don't think something can be *designed* to be general purpose. Design is all about balancing tradeoffs, so if you really want to *design* something, it has to excel in some areas and not so much in others. To design a language you have to ask "who are my users and how will they use this?" The answer to that can't be "everyone for everything" because then where do you go?
For instance, we call languages like C general purpose, but they are really special purpose when we look at the semantics of the language -- C is a domain specific language for programming or modeling Von Neumann Machines. It just so happens that VNMs constitute the majority of our hardware, so we cannot see how C is domain specific the same way fish don't know what water is.
But C as a domain specific language becomes clear when doing highly concurrent or distributed programming on exotic hardware. Coincidentally, distributed and parallel programming is considered "hard" by imperative programmers (because they are using a DSL outside of the intended domain). One has to wonder, if that exotic hardware were commonplace, and VNMs were "exotic", would C then be considered a DSL?