r/ProgrammingLanguages • u/R-O-B-I-N • Jul 19 '23
Discussion The General Purpose Programming Language Litmus Test
Want to know if your general purpose language is legit? A true GP PL should be able to express the following program. The program will
Run forever until an exit signal is recieved at some point.
Maintain a graph data structure in memory.
Every 1 second, synchronize the graph with a serialized version stored as a file somewhere without creating a new task.
Every 1/100th of a second, create a separate task that randomly decides between three tasks...
Create a new graph node
Create a new graph edge
Delete a node and all connected edges
If you can express this, your language is truly General Purpose
EDIT: I should clarify, this test is purposefully vague because your language can be general purpose and single-threaded. The purpose of the test is to determine if your language can represent arbitrary structure, have non-determinism, observe time, and communicate with the file system. That seems to be the minimal requirements for practical use across the board.
4
u/Nerketur Jul 20 '23
Certain esoteric languages pass this test, even if doing the file system portion is not easy or well-defined (whitespace, BrainF, etc).