Why make a new programming language? / Hebrew
When information about a new programming language appears in the public space, a wave of rejection rises. There is so much negativity that even the saints are taken away!
There are many reasons for this phenomenon and, most likely, nothing can be done about it, such is human nature.
However, is it possible to approach the question rationally, and still try to find an answer to the question, and why, in fact, create a new programming language?
Let’s try to analyze the motives that encourage people to do such work.
Personal creative impulse
Why do people write articles (including this one), paintings, climb mountains, descend to the bottom of the ocean, cross-stitch, knit fishing nets, and carve wood?
Why do people do creativity at all?
Different sciences deal with this issue, for many, creativity is an existential experience, someone “can’t help but create.” In itself, the answer to the question “why do people create” goes far beyond the article about the creation of programming languages.
It is important for us to note the fact that creating a programming language and a translator for it, the process is certainly creative, and therefore exciting and very interesting in itself.
That’s why many spend their time, energy, and knowledge to create a new way of communication between a person and a computer (or between people, because a programming language is also a means of communicating meaning between people).
The very fact that you can “explain” something to a computer by writing code and running it fascinates and amazes the imagination. And the possibility of managing this process in the deepest sense of the word causes inner admiration and reverence.
The process of transforming a written text into an action performed by a soulless machine has a magical, almost sacred meaning.
Programming itself is mysterious to the outside observer, and therefore often attractive, but the creation of a means of producing programs is even more mysterious. And it’s interesting.
Scientific activity is very close to creativity. Often, programming languages are created to test or implement one or another concept.
Yes, the Brainfuck language grew out of an attempt to create a Turing-complete programming language for which you can create the minimum possible compiler. The first version of the compiler for Amiga OS 2.0 occupied 240 bytes, later the size was reduced to less than 200 bytes.
Agda, Coq, Idris languages are designed for specification and proof research.
Many research projects, originally written in, say, Haskell or OCaml, often develop into independent languages.
There are many articles about languages of this kind in the Abnormal Programming hub.
Support of the subject area
Let’s move on to more mundane matters.
Therefore, it is often the case that the subject area in which certain tasks have to be solved is relatively well formalized and has an established conceptual apparatus. For example, a financial system or graphic development in CAD systems.
It is possible to solve tasks in subject areas with the help of existing tools, primarily existing programming languages and libraries. But sometimes it is appropriate to create a language in which the logic of the subject field can be embedded. Then specialized specialists will be able to use their own knowledge and skills to solve their tasks without the involvement of developers.
In Russia, such an example is the 1C language, developed to automate accounting tasks. Other examples of this kind are AutoLISP for CAD, Asymptote for preparing mathematical illustrations, G-Code for controlling CNC machines, etc.
Such languages are usually called DSL (domain specific language) or Russian – subject-oriented language.
The boundaries of this term are quite blurred, and even now I don’t want to focus on definitions. An important criterion for such languages, in my opinion, should be the priority of the subject area over the language, i.e. language is secondary to the used system of concepts.
Providing an interface to a set of libraries
When developing a large software library, a situation may arise when the library itself becomes a “subject area”. Then you can create a programming language built on top of this library. An example of this approach is the QML language from the QT library. And, although the language itself was developed as a development of user interfaces, built on top of QT, it is possible to call almost all (if strictly all) contents of the library written in C++ from it.
Due to the ease of embedding and the ease of syntax, the property of “being an extension over a library” appears when embedding Lua or ECL (Embeddable Common Lisp) within a larger project.
In the late 1990s, when the Java language began to gain momentum and already had a good user base, lawsuits regarding the correct use of the virtual machine, the language itself, and other tools were not uncommon.
Microsoft tried to negotiate with Sun Microsystem (the developer of Java) on various aspects of the use of the language, including in advertising materials, but at some point the parties went to court because they could not reach an agreement.
Including, in order not to depend on other companies in its business, Microsoft started the development of the C# language. Moreover, both of these languages were conceptually similar at the beginning of their journey, but later diverged significantly.
If you look at the TIOBE and PYPL indexes, it turns out that in both indexes the top ten languages are directly or indirectly (through sponsorship) controlled by Americans and Europeans. In the current realities, it would be good to think about what tools our country has to use.
The relationship to license agreements in the Russian Internet segment often causes a smile, but from the point of view of business, the issue is serious.
Most language compilers and libraries come with open source code. However, the openness of the original sources should not mislead, bookmarks and vulnerabilities quietly infiltrate programs.
Security experts have a lot to say here, but one thing is for sure, if a tool is developed in-house and controlled, it greatly improves security issues.
The same can be attributed to the level of a separate company. Security is easier to control if you control the entire technology chain, including, in this case, the programming language and the compiler.
Earlier we talked about creating a language to support a specific subject area. However, sometimes the subject area is so broad that it makes sense to create a general-purpose language, which, however, would be specifically designed for efficient computing in this particular area.
Such areas, in my opinion, should include mathematical calculations (colloquially, “numerical fractions”). There are several significant languages in this environment, but I particularly want to highlight the Julia language.
This language was purposefully created as a language of high-performance mathematical calculations, which can be used to write large and complex programs.
Consolidation or narrowing of semantics
This point does not refer to languages as such. Rather, it should be about the semantics of the language, but since the code is generated during the work, I decided to highlight this point.
The code in a programming language can immediately be converted to the target machine’s bytecode or binary code, and some intermediate representation, which, nevertheless, is text in another programming language. Technically, in this case, it is not about compilation, but about the so-called transpilation.
The general content of the generated code with this approach is preserved, but due to the use of a different form of presentation, the compiler or other tool can perform various optimizations and transformations.
So, for example, code from a high-level language can be translated by assembler or, which happens much more often, into LLVM IR form.
There are also examples of reverse conversion, when the code of a lower-level representation is converted to a higher-level one.
Language development is a long and expensive process. If you develop a compiler along with the language, it takes even longer and is even more expensive. (If the previous sentence seemed strange to you, then yes, developing a language and developing a compiler for it are different processes). This can be afforded either by very stubborn specialists or organizations that are able to assess the potential benefits of such development and invest several man-years in development.
Why am I writing all this?
I myself have been professionally engaged in the creation of programming languages and compilers for almost 10 years, it is difficult for me personally to be embarrassed by negativity in relation to the fruits of my labor.
I would like the reader, upon seeing another language, “it is not clear why it was created, the same can be done with the language Kh“remembered that such a work and such a publication has completely rational motives. After all, there are many reasons that can motivate the production of language.
There are many strong compilers in our country. If you look at the repositories of languages and compilers, there are active contributors from Russia in all more or less large projects, in some cases even in leading roles.
However, and this is the second problem, in the Russian industry there is currently no tendency to preserve and develop skills in this field. We use tools created in other countries, which is a bit presumptuous politically at the moment. Existing projects are either not taken seriously or ignored. Most of the projects that I know of are either focused on the Western market or have some kind of semi-marginal status.
Yes, international cooperation is underway, even in the form of receiving patches in the repository. So far it’s going. It is important not to miss the moment when it will be too late and it turns out that there is no one to do “tools for programmers” and there is nothing to do.
Import substitution, no matter how public the word is, is important to do here as well. I consider the logical development of the situation with languages and compilers in the country to be the addition of the regulatory framework on the registry of domestic software in such a way that it would be profitable for companies to develop software with the help of tools made in Russia.
PS At KDPV St. George the Victorious, who, according to legend, defeated the dragon.
PPS If you know any company or people who make languages, compilers and other similar tools in our country, mention them in the comments. The country should know its heroes!