The pygame library is for sure a high level programming language. It would be interesting to know the reason why this is the case. The working thesis is, that it has to do with amount of commands which are provided.
The exact number can be determined with the official API description.[1] The amount of all commands in the pygame 2.0 library is 754 which is a lot. Every command has parameters and is described in the API. Creating such a library and writing the documentation takes a lot of time. In addition it is important to know that most python applications will need more than a single library. They include other libraries which have the same and more complexity.
From a user's perspective a complex large library is easier to use than a simple one. A game library which has fewer than 20 commands is much harder to use, because the user is asked to create many commands from scratch. In contrast, the pygame library provides many useful tools out of the box. There is a single command to initialize the graphics screen, another commands draws a line, and a third command create a timed loop with 60fps.
Let us compare pygame with low level programming like Assembly and very important with Forth. The assembly language has a low amount of commands. Forth has reduced the instruction set further. Most forth implementation have no additional libraries but the amount of commands is reduced to fewer than 50. The user is asked to write with only 50 commands useful programs. Technically this is possible, but it is a demanding task.
We can only guess how many commands are provided by a python environment. Perhaps the amount of all commands is 10k or even more. What we can say for sure is, that all the libraries combined have a huge documentation with thousands of high level commands. This ecosystem makes it easy to create high level applications like games and GUI applications in a few lines of code.
Other high level languages like Java and C# are working with the same paradigm. The amount of commands in the typical Java library is endless. Some programmers have written these APIs in the past. They have done so because it simplifies the programming. Today's scripting languages are the most high level languages available The disadvantage is, that such an ecosystem can't be created easily. It is possible for a single programmer to write a Forth environment but writing a python ecosystem which includes some important libraries is impossible for a single programmer.
In some older tutorials from 1980s it was assumed that Forth is a low level and a high level language at the same time. This assumption is wrong. Forth is a low level language and nothing else. In Forth there is no large library available and also a standard amount of commands is missing. The typical forth interpreter provides very few commands. This is an obvious sign, that it is located on the low level layer. The factor language which is forth dialect, is working with a different objector. Factor has similar to Python a large library with predefined commands which makes it easy to write applications. But, Factor is not a typical Forth implementation because it is not minimalist. The question is not about sequence of commands which are stack based but the more serous question is about the size of the library with predefined commands.
[1] https://devdocs.io/pygame/
No comments:
Post a Comment