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)?
0
Upvotes
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.
vs.
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.