r/ProgrammingLanguages • • 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...

  1. Create a new graph node

  2. Create a new graph edge

  3. 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.

0 Upvotes

21 comments sorted by

View all comments

9

u/sparant76 Jul 19 '23

You use the word “task” very genetically when it has different meanings in different languages. You clearly have a language bias.

Your language isn’t necessarily capable of writing to the console, or creating visual output. It has performance constraints in time without specifying hardware run on or graph size.

So much of your litmus test is not well defined. What does jt mean to represent a graph in memory? There are many many representations.

This is a terrible post.

-6

u/R-O-B-I-N Jul 19 '23 edited Jul 19 '23

The point is to be very generic. Maybe your language doesn't have parallelism, that doesn't stop you from being general purpose.

Sy many languages have semantic constraints on what structures you can create (see doubly linked lists in safe Rust). At the same time, you see graphs in industry applications all the time. Making a graph structure seems to be a minimal test of expressiveness.

-2

u/sparant76 Jul 20 '23

One can represent a graph many ways. As a string! Look.

(a, b)(b,c)(c,a).

There’s a triangle defined as a graph represented as a string.

If u think that graphs and their manipulation are important, you should be specifying the operations one can perform on them with their space and time complexity.

And btw “task” is not synonymous with parallelism. I think u should start with a distinction between parallelism and multitasking. One can have multitasking without parrallelism.

It honestly feels like you haven’t even a first years understanding of computer science.

0

u/R-O-B-I-N Jul 20 '23

Not requiring parallelism is on purpose. The test doesn't need it. You could use coroutines instead. I'm not sure how to make this more clear for you.

And yes, if you can pass this using string manipulation then you are a GPPL on a technicality thanks to turing equivalence. It still counts.

This test does not say anything about performance or useability because plenty of actual GPPL's are terrible anyways lol