0
$\begingroup$

If all programming languages more or less compile down to the same machine code. Have there been attempts at, or is there a "field" around the concept of even more modular programming languages, where it can be built-up based on exactly what is needed? If arrays aren't handled, the language to simplify writing a program that is then compiled into machine code won't need to know what an array is. And, same with loops of different sorts, many languages have both for, and while.

I'm not a computer scientist. As a novice, there are so many different "language", but they're all mostly the same thing, and it seems like there might be a better way to organize the benefits each language gives relative to how much they actually overlap. I just watched Bjarne Stroustrup explain that C++ made managing complex data types easier, and that C should be seen as a subset of C++, but it seems like another way of doing it is to have an even more modular approach, treating the more complex abilities C++ has as modular add-ons, programs that can be imported. Since this is what is being done anyway except in a "one-size-fits-all" way. Basically, to not have a "one-size-fits-all" programming language, but construct what is needed depending on need.

If anyone understands what I'm fishing for, feel free to reply. It also seems such a language would make it easier for noobs to understand "programming languages", even if they could also have the choice to import more one-size-fits-all configuration.

$\endgroup$
1
$\begingroup$

The syntactic features of computer languages only exist for the benefit of human understanding; they are abstractions that are helpful for us to conceptualize what is happening in the programs. The programs themselves are agnostic to these syntactic features and the fact that the source language uses them is not necessarily reflected in the final code. The resultant machine code doesn't care whether you used a for-loop or a while-loop; the same CPU operations may be used for both. And what is an array? For us it is a complex data-structure with many rules that we must follow in order to make it work correctly, but in the computer it is just a series of adjacent data.

To be able to add or remove syntactic features on-the-fly would make programming languages much more complex allow for more opportunity for ambiguity. Since the resultant programs aren't really changed by presence of these features, it probably isn't beneficial to have to deal with the extra complexity of allowing syntactic features to be be added or removed.

Some features that are not syntactic do have a big affect on the performance of the resultant programs. For example, the memory allocation and cleanup system used might differ from language-to-language. Some other features include runtime safety checks, like bounds-checks on arrays. A notable feature that has a significant affect on the performance of resultant code is whether the language compiles to native machine code or must be interpreted by another program in order to run.

$\endgroup$
0
$\begingroup$

Not that I know of. There's no clear value to doing that, that I can see.

Once you have a compiler that can handle all language constructs, there is no need to construct new compilers that handle only a subset of constructs. There is value to programmers of having a single language to learn, rather than many variants. And most large programs are likely to use most language constructs somewhere or other.

There is lots of work on contructing domain-specific languages (DSLs), including using functional languages like Haskell to help with that.

$\endgroup$
1
  • $\begingroup$ Thanks for your answer. In evolutionary theory, natural languages relate by phylogenetic trees. I was thinking something similar for programming languages. That there must be a shitload of overlap, in how it goes from machine code to the language features. And that back in the day, there weren't that many branches of languages. But today, as noob seeing it for the first time a few years ago, there is so much. Seems like it would make sense today to restructure it, but, not initially back in the 1960s. A bit like how GIT changed things. But, not a computer scientist, so will have to learn more. $\endgroup$
    – pDiddy
    Aug 15 '21 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.