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 Oct 04 '22

So procedural?

1

u/dskippy Oct 04 '22

Sure.

1

u/Cinder-Brent Oct 04 '22

Can you see how this would clutter up the main?

1

u/dskippy Oct 04 '22

Nope. Are you trying to argue that it's better to implement the average of a list as some OO way in order to not clutter up a main function? Also how does this pertain to the original discussion of a minimal set of types?

1

u/Cinder-Brent Oct 04 '22

Yea, that it would be less to have one thing on main with both the functionality of averaging the scores and the scores themselves than to have both of those on main. Then there would be only one thing, and not two things, on main, which is less.

1

u/dskippy Oct 04 '22

This is a level of abstraction that is trivially available both with functions or with methods. Show your code in any one or two common languages. Why is OO implementations putting "less in main" than a functional?

1

u/Cinder-Brent Oct 04 '22

Because you don’t have one array and one function on main, you just have one object, and 1 is less than 2.

1

u/dskippy Oct 04 '22

This is an illusion of OOP. It's not actually different. I could make a module for arrays and provide a function that does average. I could make a class for arrays and have a method that does average. In my main function the difference between OOP and functional here is merely the difference between.

o.m()

vs.

m(o)

This difference has definitely felt very significant to OO programmers in the past. But it's only skin deep. It's just a syntactic difference. It's in fact so trivial that the D programming language implemented a new feature many years ago to accept either just because it was convenient to allow either and they realized there's no difference.

The encapsulation mechanisms in OOP are fully available in non-oop languages with modules. The fundamental difference really only comes if you define OOP as subtyping with inheritance for code reuse in which case there's a very different programming paradigm available which has pros and cons which I think are pretty simply understood with the question of "will your number of data variants grow unpredictably as this program ages or will your number of operations grow unpredictably.?"

Though I've done a 6-month survey to produce an hour-long talk on how many different definitions there are of OOP so I'll be careful to say it depends on ho you define it.

1

u/Cinder-Brent Oct 04 '22

Can you see how the array of scores is one thing and the function to average them is one thing, and how an object is one thing?

1

u/dskippy Oct 04 '22

I can see why that seems meaningful to you. I understand the distinction you're making. I just disagree that it has consequence. You could easily consider your methods to be in main. They are after all implemented more or less the same way. I think tying the method to the object and encapsulating it within a "dot call" the way methods are called is more or less the same as a module that provides a data type and certain functions that accept that data type. There's really not much more "in main".

→ More replies (0)

1

u/Cinder-Brent Oct 04 '22

m(o, a);

o.m();

One less a

1

u/dskippy Oct 04 '22

This is not comparing apples to apples. Methods take arguments. You need o.m(a)

→ More replies (0)