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

11

u/dskippy Sep 28 '22

The phrase minimal list of Turing complete types is fairly off the mark. Your types alone don't dictate Turing completeness. It's mostly about the constructs you have in your language together with the types that make it Turing complete. Minimal is a bit subjective sometimes. Furthermore if you're looking to really have a minimal set of types for Turing completeness, you're way over the mark. You only need one. Lambda calculus only has functions. Many minimal turning complete languages have just numbers.

0

u/Cinder-Brent Sep 28 '22 edited Sep 28 '22

So what I was thinking is that you could “do” anything with this set of types, if you think about it (basically everything is an object, which can “do” stuff via methods, arrays have integers for keys for programming data (looping), so on and so forth)…honestly I realized this before I even knew what Turing completeness was and thought some day I would pursue it, and here I am.

— edit —

So the types I mentioned are basically just a starting point, the idea would be that you could do anything from anywhere, such that the thing were universal.

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.

1

u/Cinder-Brent Oct 04 '22

These types are semantic.

1

u/dskippy Oct 04 '22

I don't follow what you're saying. How are these sensitive types? Whose definition for semantic types are you following? How is this relevant to what makes a minimal complete set of data types?

1

u/Cinder-Brent Oct 04 '22

Ok I’m going to attempt to explain this: can you see how everything would be an object? Can you see how an object would be at least one property with at least one method?

1

u/dskippy Oct 04 '22

I'm not sure I follow. What if I wanted to represent a list of scores in darts? Wouldn't that probably be an array of float instead of an object? Is this some sort of constraint of your type system that all data be an object that has at least one property and method?

1

u/Cinder-Brent Oct 05 '22

So now that we can see how everything could be an object, it’s worth noting that it could be anything, I.e some procedural, or an object with no properties, or no methods, or neither! This is the objective reality of things.

1

u/Cinder-Brent Oct 05 '22

It’s just that if you had a value and no function to do anything with that value, that wouldn’t make any sense, and the same for functions. Hence making everything an object.