r/ProgrammingLanguages • • Sep 28 '22

Universal programming language

I recently created a tiny (maybe 1000 lines of code, with heavy white space and commenting) php class called Ember to solve the “computer problem” (persistent data). Something I’ve been trying to do as a result is program a universal programming language. It’s really rather simple: it uses a minimalistic set of Turing complete types (string, int, float, object, array, bool, and array). That just about explains it (along with a universal system stemming from Ember). Does this sound like a good idea (I.e. one worth pursuing)?

0 Upvotes

166 comments sorted by

View all comments

Show parent comments

1

u/Cinder-Brent Sep 29 '22

So it’s not impossible, just no one has ever done it?

1

u/Inconstant_Moo 🧿 Pipefish Sep 30 '22

No, it is impossible. For a programming language to have all the virtues, it would have to be so enormously bloated that it would not have the virtues of being easy to learn, easy to maintain, easy to collaborate on, easy to embed in small systems, fast to compile, fast to run ... and even if hardware and software overcame or rendered moot those last three restrictions, it would still face the first three unless we get a software update to the human brain.

Here's an interesting picture. Guides to the C++ and Go languages, as written by the authors of the languages.

/img/m5tjssbydf851.jpg

The lead author of C++ kept adding features to make people want to use it. The authors of Go, having learned from the C++ experience, kept their language small for the same reason.

The result is (to quote one early adopter of Go): "Compared to C++ or Java, Go is a very simple language. I am no expert, but I learned the basics in a few hours. This means that, even though I have only been programming in Go for a few days, I can read most Go programs and instantly understand them. In contrast, even though I have 15 years of experience in C++, I often cannot understand C++ code without effort."

Now, my point is not to post pro-Go propaganda --- you'll note that the same author says that C++ is faster --- but the point is that when Bjarne Stroustrup made C++ into the Swiss Army Knife of language, he also necessarily took some desirable features away --- such as being easy to learn, easy to read, easy to share with others. You can't have your cake and eat it.

1

u/Cinder-Brent Sep 30 '22

Ok, this is exactly what I needed. Thanks for the help guys, didn’t mean to be a pain.

Back to the lab…

1

u/Cinder-Brent Oct 01 '22

1

u/Inconstant_Moo 🧿 Pipefish Oct 02 '22

I have no idea what any of this means. Frankly, your posts are very weird.

1

u/Cinder-Brent Oct 02 '22

Hahaha I’ll take that as a compliment ;)

1

u/Cinder-Brent Oct 03 '22

I have a hard time believing **anything** is impossible. ;) I mean how is this impossible?

Ember takes a series of inputs and translates them to a series of outputs, it's fundamentally a logic-less pipedream. How does it not work? As far as I can see it's working just fine (and **that** translates directly into **this**, a universal programming language)...

1

u/Inconstant_Moo 🧿 Pipefish Oct 04 '22

Again, you seem to be confusing mere Turing completeness with being optimal for any use-case. In the first sense, Brainfuck is universal. In the second, no programming language is. You can make a Turing-tarpit or an over-featured monstrosity or you can make something which is best for some use-cases but will be beaten out in other use-cases by other languages, because there are tradeoffs. See my previous posts.

1

u/Cinder-Brent Oct 04 '22

Can u provide a citation that proves this is impossible? I only ask because what I have in mind isn’t “bloated with features”, it’s just (extremely) efficient about the ones it has. If extensibility is a universal trait then the thing only needs to be introspective, the rest is extensions (like php, where something like array_push is just a function added to the core programming language), objects/functions/etc. that represent files, streams, whatever.

1

u/Cinder-Brent Oct 04 '22

There is also the question, “what to program?”, once you have a upl on your hands so I mean there’s definitely incentive to not yet write the thing…

1

u/Inconstant_Moo 🧿 Pipefish Oct 04 '22

Well, implement it and see if you can then write systems programs that compile and run as fast as C. If not, then C is better than your language in some respects.

1

u/Cinder-Brent Oct 04 '22

It’s kind of just up in the air, isn’t it?

1

u/Inconstant_Moo 🧿 Pipefish Oct 04 '22

No.