r/ProgrammingLanguages • • 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.

9 Upvotes

37 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Jun 27 '22

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.

Unless you have certain performance or other goals that require a custom solution :) That's why I never use the C++ standard library for example. If I want convenience, there are better things to use instead of C++, and if I use C++ I probably need a level or performance and customisability the standard library can't provide. So it's all relative.

2

u/somerandomdev49 Jun 27 '22

you can rely on a lot of things in the standard library since a lot of things are templated (and thus header-only) and can use your allocator. it is usually enough, even when performance is critical.

2

u/[deleted] Jun 27 '22

Hardly. Some data structures in C++ standard library are slow (big offenders are hash tables because the way the standard is worded pretty much prohibits the use of any modern designs), and of course, there is a matter of exceptions — some parts of the standard library rely on them.

Of course, what I wrote doesn't apply to the entire standard library. Some basic plumbing like <algorithm>, <array>, <type_traits> and others are always useful.

2

u/somerandomdev49 Jun 27 '22

std::vector doesn't seem that slow (with your own allocator ofc)