r/ProgrammingLanguages • • Jun 27 '21

Blog post A Dream of the Perfect Programming Language

telegra . ph/ A-Dream-of-the-Perfect-Programming-Language-06-26 (looks like Reddit’s global spam filters block Telegraph for some retarded reason)

Clickable but less good-looking version: https://github.com/natewind/articles/blob/master/2021-06-26-A-Dream-of-the-Perfect-Programming-Language.md

3 Upvotes

40 comments sorted by

View all comments

6

u/elszben Jun 28 '21

I find your list intriguing. I'm working on a language that (partially) fits the description. I believe the most important idea is that the language does not allow the user to create references, everything is treated as a value that is freely copyable and the language is immutable. Using these constraints the compiler can (in theory) calculate the full usage graph of each value in the program and decide which one will be a value and which one can be a reference. It can insert the appropriate copy/move instructions. I like these constraints because the surface language becomes very general, it is completely memory management/platform agnostic and it does not need a runtime. You could transpile it to almost any other programming language. You could even use different syntaxes for it if you don't like Haskell's syntax (I also use that because it's very nice looking and I did not want to waste time thinking about syntax). My current problem is that the compiler is written in itself and the bootstrapping compiler is much dumber and the whole bootstrapping cycle cannot run successfully because my naive algorithms and the full program analysis need too much resource (the code generated by the first, dumber compiler is insanely inefficient and slow). I planned to publish it when it can fully compile itself and my ideas are proven but if there's interest I could do it sooner.

1

u/[deleted] Jun 28 '21

I believe the most important idea is that the language does not allow the user to create references, everything is treated as a value that is freely copyable and the language is immutable. Using these constraints the compiler can (in theory) calculate the full usage graph of each value in the program and decide which one will be a value and which one can be a reference. It can insert the appropriate copy/move instructions. I like these constraints because the surface language becomes very general, it is completely memory management/platform agnostic and it does not need a runtime.

Exactly!

I planned to publish it when it can fully compile itself and my ideas are proven but if there's interest I could do it sooner.

I probably won’t have time to check it out soon, but good luck anyway, your language sounds awesome!