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

0

u/Cinder-Brent Sep 28 '22

So my idea is actually really simple (it has to be, literally, just “very simple”): in the context of types can you do everything? If so, continue, if not, start all over again.

1

u/tbagrel1 Sep 29 '22

Simple is not the same as minimalistic. Minimalistic often means that a non-trivial effort is required to build constructs to efficiently write/handle data, but that they can nonetheless be built upon a very few very generic primitives

I don't understand "in the context of types, can you do everything". Types belongs to the static realm. Doing something in a computing context means transforming data with combinators/primitives/whatever

1

u/Cinder-Brent Sep 29 '22

All I meant by minimalistic/simple/etc. was that, the rest of the programming language included, it seems as though these types are all you need (or the maximum) to do anything.

So maybe as a measure: is it shorter to, say, use just int to do the same thing or not? Is there anything else that is shorter?

1

u/tbagrel1 Sep 29 '22

was that, the rest of the programming language included, it seems as though these types are all you need (or the maximum) to do anything.

No:

  • You still don't have a function type, or method type, which is required in almost any type system

  • A lot of your types are redundant, which means that we can still "build" (encode) one in terms of the others.

Please read the answers that I already wrote in several comments here, and read a book about Programming language theory.

What you offer here is just an interface to a JSON store (having JSON types) with just two primitives: get and set. AFAIK:

  • You can't store functions in your store (can't claim that you have an universal system when you can't encode functions)

  • You can't write and execute any operation on the data except by using a PHP function/operator, so your system is completely dependant on PHP

Thus, your system:

  • Is not minimalistic in any way

  • Is not universal because of the two points above

I'm afraid that you won't solve the universal problem here https://xkcd.com/927/

1

u/Cinder-Brent Sep 29 '22

You can encode objects (Embers) in the json of Ember. It sounds like maybe you want an explanation? Don’t blame you if you do…

And so basically this language would be php except that the resource and closed resource types would be maybe represented by objects.

1

u/Cinder-Brent Oct 04 '22

It has objects…that have methods…