📜 ⬆️ ⬇️

The use of national languages ​​in SPL programming

Surely every programmer takes it for granted that the main program code is written in English. You can argue about whether it should be so or whether it is just an anachronism, but it can be different.

Indeed, as a rule, programming is carried out in English. And there are several reasons for this.

The first is the standard. And it exists not only in programming. Since school, we are accustomed to write:

y = sin(x) 

and not at all:
')
  = () 

Therefore, of course, any library function should have its basic designation, and it will most likely be in English.

The second is internationalism. Hardly anyone specifically develops a programming language for use exclusively in one country of the world and in only one language - Russian, Chinese, Hindi ... It would be extremely impractical. The language should be as accessible as possible to everyone, if, of course, this is not a special mnemonic for a limited number of tasks. Well, once international, it is - English, as the most simple and common international language.

The third is, of course, the story of the creation of the language. Despite the large number of programmers both in Russia and from Russia, programming technologies are developed, as a rule, by large international corporations. And the language is chosen there, of course, English.

To be fair, it should be noted that there are programming language developments which are based on national languages ​​other than English. That is, you can find such code samples:

 (1 , 2 , (1) ): _ ___; *=___.1; =; ___._=; ___._=; =___; 

The question of the convenience of such coding is left open.

In short, it is completely understandable and not surprising that, with the exception of comments, the program code will be in English.

And now about whether it can be different. As a language developer, I’ll say right away that the ability to use the spelling of variable names, user functions, library functions in an arbitrary language should be laid down in the capabilities of the language, in its syntax initially, at the time of creating this language. That is, the simultaneous possibility of such a record:

 y = sin(x) 

and such a record:

  = () 

would be equally acceptable for both the computer and the programmer.

And there is some good news: first, Unicode has long been invented, and second, they continue to invent new programming languages, such as the SPL language.

In SPL there are no restrictions on the language in which the names of variables, functions, and other objects are called. Examples of valid names:

 N x1 123k 颜色 

Okay, fine. Suppose there are no problems with variable names, and you can call them as you please. But what about the constructions of the language itself? Cycles, transitions, keywords that are in any programming language - how to deal with them?

Elementary. There are no keywords in SPL. This language is so simple that he simply does not need them. Cycles and transitions? Here is the cycle and the transition:

 > '  < 1 -> '       "1" 

Symbols instead of keywords? Yes, why not! After all, it is unlikely that you have already forgotten that "->" is a transition to a label. That is nothing complicated here.

Well, what about library functions?

It's simple. Of course, the basic version of the library functions has English writing. The sine function there is the usual sin (). But in SPL functions are the same objects. And they can be assigned to other objects. That is, you can write:

  = #.sin 

which means that the “syn” object is now equal to the “sin ()” library function, and, if you wish, now write easily:

  = () 

In SPL, the insertion of program files into other files is very simple - just one "$" character:

 $file.txt 

and the file “file.txt” will be inserted into this place of the program. And in this file there can be, for example, a list of your own library function overrides.

In conclusion, I will give an example of the same recursive function of calculating the factorial of a number written differently. Please note that all these options can easily be in the same program code. So to write program code in English, Russian or any other language is solely the choice of the user himself, and not the requirement of the language, if this program is written in SPL.

 fact(n)= ? n!>1 <=1 . <= n * fact(n-1) . #.output(fact(5)) 

 =#.output ()= ? !>1 <=1 . <=  * (-1) . ((5)) 

 $中文阶乘(号)= ? 号!>1 <=1 . <= 号 * 阶乘(号-1) .印(阶乘(5)) 

where is the contents of the 中文 file:

 印=#.output 

Thanks for attention!

Source: https://habr.com/ru/post/330684/


All Articles