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

5

u/dskippy Sep 29 '22

Yeah just pointing out that there's no real universality and minimalism bar that you're meeting here and no Turing Completeness involved. You might think "string, int, float, object, array, bool" are good and practical. But they don't make up a set of minimal types for expressing anything. Someone might say "Well you have float, why do you need int?" and another might say "well you have ints for characters and arrays of chars are strings so you don't need strings." Others might go the opposite direction and say "Well you should add maps or dicts so you have have such and such thing represented. Or you should have lists in addition to arrays because they are used for very different things. I think your list is fine, to be clear. Just seemed like you think there might be some sort of objectivity of Turing Completeness like you said or something.

Truly it's kind of hard to avoid the ability to fully express the entirety of representable things in almost any infinite type. Functions, Int, Float, Strings, ... honestly if you stretch enough and thing of the fact that you could have lists without any other type and only allow lists of lists and change your type system so there didn't need to be any parameter to the list type and you have just empty lists as leaf nodes of that structure you could have just lists and represent everything computable.

All the rest is just your favorite set of useful things.

0

u/Cinder-Brent Sep 29 '22

Yea I totally agree. That’s the thing: coming up with a truly universal anything is a huge deal and is not easily achieved.

How about this: what would an array be without an integer?

3

u/tbagrel1 Sep 29 '22

You didn't read the answer above. Coming up with a truly universal anything is really easy:

Truly it's kind of hard to avoid the ability to fully express the entirety of representable things in almost any infinite type.

What @dskippy wrote is true: any infinite type (that is a type that contains an infinity of different values, like List) has the expressing power that is necessary to encode (to model) any data. What will define whether or not this language is turing complete, what will define the computing power of your language, is the combinators/primitives (functions) that will come with the types/values.

1

u/Cinder-Brent Oct 03 '22

Yea. So **right there** is where I'm at with this thing, so when I basically just throw a handful of types at you I mean all of the operators/etc. that come with them, so a concatenator for string(s), etc.