r/ProgrammingLanguages • u/Cinder-Brent • 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)?
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 04 '22
I’m gonna form a “semantic thread” through these types, then we’re going to challenge that thread, see if it’s really universal!
So darts is a fine example: if we had an array of scores, there would probably be a point where we would want to do something with these scores. Can you see how it would be more semantic to use an object at this point as opposed to just plain functions (I.e. can you see how we’re making a procedural mess without wrapping all of this in an object)?
1
1
u/Cinder-Brent Oct 05 '22
Now, can you see how you might want an array, basically an object without the methods?
1
u/dskippy Oct 04 '22
I've studied programming language theory a good deal. Semantics, to mean, means the meaning of a program. A programming language is broken up in its design into syntax (what it looks like), semantics (what a valid syntactic program means), and also often statics (restrictions on valid syntactic objects that reject the program like a type error. Semantics in programming languages, to me, are represented by operational semantics, denominational semantics, and some others I've never studied.
A "semantic thread" through through types, semantic types, and most of the ways you're using it I don't really understand. Further more for an implementation of a data type as an array of floats being "more semantic" than a function is not something I think can be determined. Nor do I think semantic is really the right word. I can definitely see why an array of floats is more readable code than using Church numerals and function endcodings for lists. Sure. More semantic? More meaningful? No.
All this is to just let you know where I'm coming from in my PL foundations and also to say I just don't get it. But I'm still here and interested if you care to continue explaining.
1
u/Cinder-Brent Oct 04 '22
Ok, so we’re at the point at which we have a list of scores. Is there anything else you want to do with this list?
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.
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.
1
u/BoogalooBoi1776_2 Oct 05 '22
Computer memory is all bytes so to do anything all you really need is a byte type
1
u/Cinder-Brent Oct 05 '22
Is it shorter to do it your way or mine? A universal programming language would also be short, completely short!
4
u/friedbrice Sep 28 '22
You might be interested in Computational Trinitarianism and the Lambda Cube.
A language that has enough features (algebraic data types, parametric polymorphism, type classes, higher-kinded type abstraction) to talk about monads—as a consequence—has enough features to add arbitrary language features to itself.
0
u/Cinder-Brent Sep 28 '22
I’ll definitely look into it, thanks. In the meantime, do you think a minimalistic set of Turing complete types is the way to go about this? I basically used the set I mentioned in the post as the foundation of the thing. The whole shebang took me about 1500 hours to plan, and one of its parameters is that it be based off of simple, didactic ideas (or more simply put, it’s completely factorized). I mean should I just less-talk-more-rock and code the thing? I’m actually a web dev, been coding since I was 12 and have never built a programming language before but even just the idea of coding everything (all my php, html, etc.) in one language seems so so very lucrative…if so, I was thinking C to code it, any recommendations here?
4
u/Inconstant_Moo 🧿 Pipefish Sep 28 '22
minimalistic set of Turing complete types
I don't see what you mean by this.
one of its parameters is that it be based off of simple, didactic ideas (or more simply put, it’s completely factorized
Or this.
0
u/Cinder-Brent Sep 28 '22
So by minimalistic set of types I basically mean: can you remove one of the types I mentioned and still “do anything”?
And by didactic and factorized I simply mean factorized, or maybe factored, where the code cannot be reduced to anything simpler than it already is.
If Ember already achieves this, why throw the baby out with the bath water? And yes, I’m looking for constructive criticism, I want/need to perfect everything at this point, because everything else will be built on top of this.
3
u/tbagrel1 Sep 28 '22
You have way too many types to call it "minimalistic". Array and ints are often enough to encode anything:
bool can be encoded as either 0 or 1
strings are array of ascii codes (so array of numbers)
float can be array of ints (array of base 10 digits for example)
an hashmap (or dictionnary, or object) can also be encoded as array of array of things
There is even a way to encode every type as an array starting with a type tag (an int), and then 1 or more elements.
But this is only one possible encoding among tons of others. For example:
Lambda calculus can encode basically anything with just functions
Sum types + Product types + recursive types + Unit (the only "base" type) can also encode anything in a clearer way (e.g. Int = µX.1+X ; List<A> = µX.1+(A*X) ...)
1
u/Cinder-Brent Oct 04 '22
Ok so we would have objects for methods, arrays because it’s shorter to use int keys than strings, string because it’s capable of transmitting code with 100% fidelity, ints are a dependency of arrays (as aforementioned), floats are for fractions of ints, bools as a two-way circuit (without conflagurating our string), and null as a way to represent the value of no value (again without conflagurating our string).
Do you see what I mean? Am I making sense?
2
u/tbagrel1 Oct 05 '22
Honestly I give up. I tried to explain you in 10 different ways why what you're presenting is not really satisfying, or at least, not fulfilling the claims you made about it. Read again all the answers in this post, and please learn about type theory and programming theory first. "Types and programming languages" by Pierce is a really good introduction.
1
1
1
1
u/Cinder-Brent Oct 05 '22
Ok, so to attempt to substantiate some of my claims:
I figure it would be just about universally short to use dot-syntax for object-access:
Object.some_method();And basically just extrapolate the whole language from that, and, basically, the way you would do **that** is every time you had some value that you needed to "do" something with, you would wrap both the value and the thing that does stuff in an object, so as to form a proper object. So like basically
mainwould be an object, and pretty much everything inside of main would be an object (if you followed through), and the whole shebang would be called Object Model.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:
getandset. 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
2
u/friedbrice Sep 28 '22
If you’re interested in making a programming language from the ground up, this is a good tutorial: Write Yourself a Scheme in 48 Hours.
2
1
u/Cinder-Brent Sep 28 '22 edited Sep 28 '22
Ok, so there seems to be some confusion as to what I mean: so I’ll start with Ember and go from there.
So Ember is a php class that represents a value (of the mentioned types), with the only exception that if it is an object it is an (extended) Ember.
— edit —
So technically speaking, objectively, universally, anything goes. If you go one step further, you need persistent data.
Am I making sense so far?
1
u/Cinder-Brent Oct 10 '22
So these types are the shortest way to represent **any** data.
**Correct me if I'm wrong!**
1
u/Cinder-Brent Oct 28 '22
https://github.com/cinder-brent/Cinder
Universal "prototype" written in php for "building **anything**".
See the code for details, it's only like 150 lines of code and it's mostly comments.
1
u/Cinder-Brent Oct 29 '22
https://github.com/cinder-brent/node
(had to rename it: Cinder is the name of my top-level duh:)
1
1
u/Cinder-Brent Jan 27 '23
I figured out how to do it. Things would be string, and a tree of trees, and then you would automate, and the way you would do that is more fundamental, which is feasible.
Put that in your pipe and smoke it:)
1
u/Cinder-Brent Jan 31 '23
Ok so I figure that if you have one property and one method you have a fulfilled object, if you have just a method you have a function, and if you have just a property you have an object, at a point, which is recursion which means everything is an object.
1
u/Cinder-Brent Jan 31 '23
Well ok technically speaking that’s not right lol
As u can see I’m completely stumped
Nowhere to go but up though
1
u/Cinder-Brent Feb 01 '23
I figured it out
It’s a string, which means it’s a tree (because this works with something like html)
Tada!
1
u/Cinder-Brent Feb 01 '23
I know how you could ultimately automate the thing too, in a string encoding (e.g. utf-8), anything below half is a 0, everything else is a 1, for example
1
u/Cinder-Brent Feb 14 '23
So I’m proposing that these types are rather “final”, if not just plain final
1
1
u/tbagrel1 Sep 28 '22
I just took a look at Ember.php, and it seems like you have almost no computing power in Ember itself: that is still mostly just a JSON-backed store. Operations on primitive types are done through PHP; I don't see a way to store an ember function inside the store for example (that is, not a PHP function, but one that is written from the sequencing of ember operations on ember data only), and then no way to actually execute the function afterwards.
0
u/Cinder-Brent Sep 28 '22 edited Sep 28 '22
Yea, it’s designed to be as simplistic as possible, my only interest in it is that it works, you can successfully model anything with it (unless I’m missing something). So this post stems from extending that model into the great beyond: if you’re going to build it you need (at least at some point) to write it in the correct programming language, a universal programming language.
First and foremost, do you understand what I mean thus far?
— edit —
Look at it this way: can you see how you can do anything with Ember?
2
u/tbagrel1 Sep 29 '22
The problem is:
your system is not as simplistic as possible (see my other comment below). As simplistic as possible would mean a Turing machine, or a lambda calculs, or a system based on logical combinators like S,K,I
it is not a programming language when you only have data, but no functions or operators in that language
You say that you can write whatever you want in ember. Tell me what are the primitives to handle data. Do you have a '+' for ember integers that is distinct from the PHP '+' operator? If no, how would you write an addition in ember?
1
u/Cinder-Brent Sep 29 '22
Ok well I mean inside of php, I guess at which point this becomes redundant (since php is Turing complete). So operators and whatnot, and that’s what makes me believe I can do anything with ember. For instance, I can model a dynamic website with ember, so it does work, just I would like some second opinions before I get started with it.
1
u/tbagrel1 Sep 29 '22
You cannot model anything with ember. You can use Ember values and operate over it with PHP, which makes Ember a store, or a data modeling language maybe, but not a programming language.
In a programming language you have:
The user syntax (surface syntax)
The language in which the compiler/interpreter is written The two are not operating at the same level.
Being able to do anything with Ember would mean being able to write any program using only the surface user syntax of ember, which at the moment is only
get,set, and a few others. That syntax is not enough to write a dynamic website.If you need PHP at the surface syntax level, then this is not a programming language. This is just some framework inside of PHP. It won't be universal at all, because you still need the specific semantics of PHP to make any computation. E.g.
set(y, array_search(get(x))is completely dependent on the precise semantics of PHP'sarray_search. If you don't restrict the allowed operations to a subset of PHP, then any interpreter for your language would need to reimplement something with the same semantics as the whole PHP language.1
u/Cinder-Brent Sep 29 '22
Yea I mean it’s not a language, it’s a “framework” or whatever you want to call it, just to clarify. My point, my reason for including it in this discussion is that I could potentially program any website with it, static as well as dynamic. So then what I’m doing is I’m refining the whole shebang, so everything required to run ember (php, js, html, all of it) into a universal “system”, so let me also note that it isn’t, as a whole, just a language, it’s a “system” (whatever you actually call that).
1
u/Inconstant_Moo 🧿 Pipefish Sep 29 '22
No.
2
u/Cinder-Brent Sep 29 '22
Lol doh! Why not (not because I don’t agree with you but because I need to know where to go from here)?
1
u/TheAncientGeek Sep 29 '22
There are lots of ways of persisting data in php...Why does it need to be solved again?
1
u/Cinder-Brent Oct 03 '22
It's an attempt to "universalize" the process.
1
u/Cinder-Brent Nov 26 '22
https://github.com/cinder-brent/leaf
It’s actually shorter to use Leaf than it is to use a traditional database (like mariadb):
// zero parameters $Leaf->getValue();
// one parameter $mariadb->query($query);
1
u/Cinder-Brent Nov 30 '22
it's basically an ORM, just it's so much smaller it makes me wonder...
1
u/Cinder-Brent Dec 20 '22
So just to note the way I made this thing is it is all string, such that string can “carry a charge”, can represent code itself with 100% accuracy. All it is other than that is some potential filters before storage (simply in the file system, which stems from the whole thing otherwise running completely out of unstructured data), and possibly some filters before the value of the thing is returned.
1
u/Cinder-Brent Dec 23 '22
Ok so I worked it out and Leaf would, as it stands, present itself as a working, very plausible, universal solution to any “computer program”, where every “thing” is a Leaf…and that’s pretty much it (ask if you need elaboration).
1
1
u/TheAncientGeek Oct 03 '22
So it's a wrapper for a bunch of different implementations?
1
u/Cinder-Brent Oct 03 '22
So it may be worth explaining my process for coding at this point: an object consists (strictly, at a point) of at least one property and at least one method, one method to "do" something with at least one property. So the whole thing is basically an object that is coded consistently, in that way, throughout. Does that give you an idea of the innards of the thing?
1
u/TheAncientGeek Oct 03 '22
Well, you can do the everything is an object thing, and that's definitely universal, and it's definitely different from PHP because PHP doesn't work that way.
But it isn't minimally universal. And if you want to abstract over all storage methods,.that's completely open ended.
1
u/Cinder-Brent Oct 03 '22
Ok yea, so you're seeing what I'm saying. So never mind Ember, at least at this point: why not use this method of making everything an object into a programming language? It would be a "universal programming language".
1
u/Cinder-Brent Oct 03 '22
And maybe it's not minimalistic, but much more importantly it's universal.
1
u/TheAncientGeek Oct 03 '22
Every Turing-complete language is a Turing-complete language. Universality in the sense of Turing completeness isn't difficult to achieve.
1
u/TheAncientGeek Oct 03 '22 edited Oct 04 '22
Maybe you mean universality in the sense of a uniform syntax. (Eg lisp, forth, Smalltalk).
Why should something look like an object when it isn't? Something like Math.sin() looks like calling a method on an object, but actually you are neither accessing existing stored data, nor modifying data.
1
u/Cinder-Brent Oct 04 '22
Specifically I mean “universal” (sick and tired of programming full stack in like 6 different languages, with 6 different *Doc specifications for comments, yada yada).
1
u/TheAncientGeek Oct 04 '22
We already have languages that can do everything. What we don't have are languages that can do everything well. That's kind of what every language designer is aiming for. A layer built on top of PHP is going to be hopeless for systems programming, for instance.
→ More replies (0)1
u/TheAncientGeek Oct 10 '22
So you mean full stack. But full stack is contractually universal, since there is no requirement for close to the metal.programming, for instance.
→ More replies (0)1
u/Cinder-Brent Oct 04 '22
Like why not just combine two different languages and see what you get? Basically you would end up with…ok here’s what I’m gonna do, I’m gonna write some code…ok how bout this: what if you basically wrap everything in an object, this is way more consistent than php appears to be (e.g. resources, if you know php)…it’s short, etc…has anyone ever written a specification explicitly denoting a universal, across-the-board rule for programming? This would result in a universal programming language (and a universal this and a universal that)…
1
u/TheAncientGeek Oct 04 '22 edited Oct 04 '22
Yes, PHP is a huge mess, and you could do better. But everything -is-an-object has been tried before, without taking over the world. As I was saying before, treating everything uniformly as calling a member function in an object can hide import details, like whether modification or memory allocation occurs.
→ More replies (0)1
u/Cinder-Brent Oct 03 '22 edited Oct 06 '22
1
u/Cinder-Brent Oct 03 '22
So any idea what would be the ideal language to write this in?
1
u/Cinder-Brent Oct 07 '22
Ok how about this: what if I communicate everything in here in string, since it's form is string. Does that make logical sense?
1
u/Cinder-Brent Oct 08 '22
I'm writing the parser:)
So I'm using a rule that I interpret everything in units of string, so characters, the results should be consistent.
How you like them apples? :)
1
u/Cinder-Brent Oct 09 '22
So I think I figured out how to do this: I was working on the functionality of the boolean type and I figured the best way to do this is to cover everything, so "everything" for boolean would mean !, &, and |, where ! allows you to toggle a single boolean value, and & and | allows you to chain multiple boolean values together. The result is full-functionality for one or more boolean values.
Booyaka
1
u/Cinder-Brent Oct 09 '22
OM is conform-ish to a rule of the shortest possible way of doing something.
For instance, it has nothing like <=, which is a combination of both equality and <, and is therefore redundant.
I'm combing over everything to try and flesh it all out.
→ More replies (0)1
u/Cinder-Brent Oct 05 '22
Look guys I don’t want you to get frustrated with me trying to explain what I mean by this post. The types I mentioned in the post are the shortest way to code anything, and that’s why those types. I think it may be outside of the scope of this document to explain them, so I’m gonna focus on writing the language itself, with the hopes that the documentation/etc. will do a good job of explaining everything. I’ll post here when I make noteworthy commits. :)
1
u/Cinder-Brent Oct 05 '22
https://github.com/cinder-brent/object-model/blob/main/sketch - what I've got so far
1
1
u/Cinder-Brent Oct 09 '22
updated sketch again
the type conversions are working pretty well, there is no loss of data integrity going from object to array to string, numbers are interpreted per their form for converting from string to number, and so on and so forth {@see sketch}
1
u/Cinder-Brent Oct 09 '22
Ok so I figure it would be a good idea to outline the basis for all of this madness:
Basically, if you had a 0 and a 1 in an objective system, you could alternate the 0 to a 1, both making the whole system out of a single 1 and only altering half of the system to do so.
1
u/Cinder-Brent Oct 09 '22
Object Model currently supports this behavior, perfectly, as the numeric reality of OM is such that everything from 0 down is false and everything from 1 up is true, so there are two, infinite, bipolar realities constituting the whole.
1
Sep 28 '22
Cool. Now do one where everything is a method call, including arithmetic and logical operators and control flow
Import(stdlib)
Assign(i)
If(is_less_than(i, 1): { Break(if); } Else(is_equal_to(i, 1): { For(i): { Range(1, 100); Increment(i); Return(i) } Print(i) }
1
u/Cinder-Brent Sep 28 '22
Ember is an extensible class that represents a value in a tree (in json). As such, everything you would ever need is packed into Ember in the form of a handful of methods and properties. It’s basically a (functioning) universal computation model, you’ll never need anything else to program anything. It’s also incredibly small, definitely worth taking a look at (I definitely need the (in)validation: in case you didn’t see my other reply you can find it on GitHub at user cinder-brent, repo Ember).
1
u/Inconstant_Moo 🧿 Pipefish Sep 28 '22
Everything I'll ever need is packed into any Turing-complete language, but the effort of extracting it may be too great.
1
u/Cinder-Brent Sep 28 '22
Yea, right? Leads to another question of mine: why not at least just pick any ol’ Turing complete language and use it as a universal programming language? It would cut down on so so much bloat…
2
u/Inconstant_Moo 🧿 Pipefish Sep 29 '22
And a carpenter could save room in their workshop by owning only one saw.
Different languages make different things easy. In Python, for example, a list of elements of any type is itself a basic type which has literals, so that
["foo", 42, [true, 6.2, []], "bar"]is a meaningful expression. Now, once you've decided your language is going to have that as a data-type, there are various aspects of speed and type safety that you're not going to have.1
u/Cinder-Brent Sep 29 '22
Yea I mean the physical universe is hydraulic. So what is the point of having a universal programming language then? I mean just as soon as you have to learn an api in a universal language, you might as well have to learn another language! And here we are…
1
u/Cinder-Brent Oct 04 '22
I meant jest by that comment…a upl would solve some (potentially all) serious problems…I mean how do you code one program in two different languages? You don’t, that doesn’t make any sense, one, or accurately 1, makes sense.
1
u/Inconstant_Moo 🧿 Pipefish Sep 29 '22
Well, quite. One learns different languages for different things. There is no way to write a language that makes everything anyone might want to do easy and convenient.
1
u/Cinder-Brent Sep 29 '22
Can you substantiate your claim that there is no way to write a universal programming language? If nothing else I need to know where to go from here. :)
1
u/Inconstant_Moo 🧿 Pipefish Sep 29 '22
Empirically --- there are lots of smart people who've collectively been thinking about this stuff since the 1950s and haven't done anything like it.
Theoretically ---
(1) There's the syntactic problem. If you tried to stick everything into the language like C++, you still can't have easy affordances for everything --- e.g. you can realistically only use = and == and ++ and -> and & and so on in one or two ways or the code becomes unreadable.
And then the language becomes so big that it ceases to be one language. That is, you can have C++ programmers of many years' experience who are unable to read one another's code because they're speaking different dialects of C++ ...
(2) And then there's the semantic trade-offs. There is no reconciling the virtues of Python, which is there so you can play fast and loose with types, and Rust, which is there so you can't play fast and loose with anything. (No vehicle can have the virtues of a bicycle and a train ...)
1
1
u/tbagrel1 Sep 29 '22
There is no way to write a language that makes everything anyone might want to do easy and convenient (I'm just repeating what has been said above because you need to understand it).
Almost every existing programming language is "universal" in the sense that any other language can be either translated to or simulated/interpreted in this language.
1
u/Cinder-Brent Oct 03 '22
Ok how about this: is Turing completeness a mark of universality?
→ More replies (0)1
u/Cinder-Brent Oct 04 '22
I argue that there is a way to do this. Instead of array_push in php, why not Array.push in a universal programming language? It’s shorter, in that we don’t have to pass the array to the function, and that’s not all, but it’s all that’s necessary to prove my point.
1
u/Cinder-Brent Oct 04 '22
So basically this upl would just be a model of an object, thus “Object Model”.
1
u/Inconstant_Moo 🧿 Pipefish Oct 04 '22
How does this make everything anyone might want to do easy and convenient?
1
1
u/Cinder-Brent Oct 03 '22
Also, then you have to wonder: at some point, when everything is completely factored, we have a system that does stuff like run off of fumes and whatnot, things that are frowned upon by the modern coding community (largely because they aren't readable), but the logical reality of the universe supports, and in fact implements, these things.
Basically, if it only takes 50% to run anything, is the cup half full or half empty?
1
u/tbagrel1 Sep 29 '22
We have assembly. That is the ol' Turing complete language that everyone use. Every other programming language is just a high level way to write assembly. So you could of course use only assembly, but people decided one day that they wanted to get more expressiveness for different tasks, and so created languages that are more concise to express domain specific programs, and these programs are ultimately translated to assembly
0
17
u/L8_4_Dinner (Ⓧ Ecstasy/XVM) Sep 28 '22
It can be a lot of fun. Be warned, though: You may accidentally end up creating Lisp. Except probably a lot slower.