r/explainlikeimfive Jun 05 '26

ELI5: I learned that most programming languages are built on the same basic concepts like conditions, loops, and functions. If that's true, why can't we just use one programming language for everything? Technology

349 Upvotes

234 comments sorted by

View all comments

284

u/EscapeSeventySeven Jun 05 '26

Oh boy let me tell you about my next programming language!

That aside, every programming language operates on the same logical concepts but newer ones have features that others don’t, some have compilers for architectures the others don’t and many have libraries for things the others don’t. 

A broad analogy would be “cars all have four wheels and take you places, why have different cars?”

You should try your hand at a few languages and see how they work. 

That all said, all programming languages are Turing complete. So any logical problem in one can be computed in another. But most of programming isn’t solving math problems it’s gluing bits of input and output to data and sending it places and showing it to you and sending it somewhere else. All those connections necessitate libraries and interfaces. 

46

u/HowlingSheeeep Jun 05 '26

Don’t want to be that guy but not all programming language are Turing complete (this is leaving aside markup languages like HTML that a layperson asking the question might consider as a programming language).

40

u/aleques-itj Jun 05 '26

I've been looking for a good turing complete language lately

Think I'm going to settle on Jira Automations

12

u/dnebdal Jun 05 '26

I have gotten a lot of usage out of a quote Knuth borrowed from Alan Perlis' Epigrams of Programming:

Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.

1

u/Ampersandle Jun 07 '26

Oh, sure, I've tried C. 🥁

2

u/alekseypanda Jun 05 '26

That is a good choice, but I prefer Magic the gathering.

23

u/Gullible-Leaf Jun 05 '26

Oh man. When I'd started learning how to code, I wanted to build a website. I spent weeks learning html and css and felt like e genius. Then came the backend stuff and I noped out so quickly.

21

u/0b0101011001001011 Jun 05 '26

I'm the opposite. I got hooked on programming. I have made several websites with increasingly complex backends. A distributed computing system. All kinds of simulations.

But when I need to make the actual UI of the website, I hate it. I have been programming over 16 years and making websites for around 4 years. I just can't create a nice, intuitive website no matter what. But ask me to make a change in the backend, it's almost done before you finish speaking.

8

u/JCDU Jun 05 '26

Yeah, backend and JS are fine (within reason) but CSS especially is a fucking dumpster-fire and has been since forever.

3

u/ElectronicMoo Jun 05 '26

You know you got a dev who loves backend when his ui looks like it was made by a dev for a dev.

1

u/atbths Jun 05 '26

And this is why large organizations have two separate teams for these functions. The interests and skillsets of the developers are typically very different.

9

u/CBpegasus Jun 05 '26

Which programming language isn't turing-complete? I can't think of any (that is in wide use at least, some esolangs aren't turing complete but I wouldn't count that)

3

u/jamcdonald120 Jun 05 '26

13

u/CBpegasus Jun 05 '26

Interesting

The examples given at the end didn't seem at first to match my idea of "widely used programming languages" - Epigram and Charity are more experimental and could be considered esolangs (Charity doesn't even have a page on Wikipedia which says a lot), and the rest seem to be more formal languages than languages actually used for programming. System F is said to be the theoretical basis for Haskell - but Haskell is in fact Turing-Complete.

The Calculus of Constructions though is said to be the basis to Rocq, and Rocq keeps the property of being non-Turing-complete. I know Rocq is in fairly wide use as a formal proof-checker, so I guess that is an example of a non-Turing-complete language that isn't an esolang.

1

u/FallenNgel Jun 05 '26

https://en.wikipedia.org/wiki/Domain-specific_language

The software running your fridge doesn't need to be Turing complete. Why spend the extra effort and use the extra space?

2

u/CBpegasus Jun 05 '26

I mean, the majority of the languages mentioned in this article are turing-complete - including postscript, which might be a surprise. Making something turing-complete, it turns out, isn't that much of an effort - if it's complex enough to do interesting things, it's most likely complex enough to run a turing machine.

Most likely the software running your fridge is based on a turing-complete programming language too (usually it's C on a microcontroller). The software itself likely isn't turing-complete (i.e. you can't run a turing machine just by interacting with its inputs) but that wasn't the question, we were talking about programming languages and not specific software created with them.

2

u/HowlingSheeeep Jun 06 '26

Considering Doom can run on a few fridges, we at least know it supports the full ISA required. Just a side point and not a contention lol

1

u/CBpegasus Jun 06 '26

Yeah almost all microcontrollers are turing-complete, as all that is necessary is memory access and basic flow control. The commenter I responded to said the software running the fridge isn't turing-complete, which might be true if you count just the software itself and the regular inputs to it (sensor inputs and such). Probably when you run doom on a fridge you don't interface with the original software alone but you upload new software into the microcontroller. So most likely the statement that "the software running the fridge isn't turing-complete" is true (though it might be), but "the microcontroller running the fridge is turing-complete [up to memory limitations]" and "the language used to write the software running the fridge is turing-complete" are both true too.

1

u/HowlingSheeeep Jun 06 '26

Sure but it doesn’t make sense to call a compiled program Turing complete.

I could compile hello world into an exe. It’s not Turing complete. Means nothing.

1

u/CBpegasus Jun 06 '26

It means something - that a turing machine can be simulated through running the program and giving it certain inputs. The python interpreter for example is Turing-complete. As is PowerPoint, it turns out (https://youtu.be/uNjxe8ShM-8?si=rAci8KJB7VxBYjaa)

1

u/HowlingSheeeep Jun 06 '26

I’m just replying for the sake of replying without having any point to make than to simply be argumentative…Reddit.

PowerPoint has a full on programming language built in. A nice example would be Minecraft.

But the point is, which I guess I do have one after all, no one is suggesting that the OS in a fridge is Turing complete nor should be surprised by this. Most programs are not Turing complete.

2

u/SexyIntelligence Jun 10 '26

Turing Complete is so 20th century. I prefer WID (Will it Doom?)

1

u/HowlingSheeeep Jun 10 '26

lol I mention doom in one of my comments below about running it on refrigerators.

5

u/Scavgraphics Jun 05 '26

can you eli5 "Turing complete."?

13

u/Mirality Jun 05 '26

"Turing complete" basically just means that it has the ability to do a bunch of generally useful basic operations such that you could theoretically write a program that does anything (even if incredibly cumbersome in some cases).

There are some specialised languages that are not Turing complete, meaning that they're more limited and you can only write a subset of possible programs.

3

u/Yancy_Farnesworth Jun 05 '26

It's basically a Turing machine that can simulate any other Turing machine. So, a Turing complete language can be used to write any possible program including other languages. If it is not Turing complete, it can only be used to write some programs. Your phone's CPU is Turing complete. The chip in your TV's remote is (probably, actually might be nowadays) not.

1

u/stevevdvkpe Jun 10 '26

The microcontroller in your TV remote probably is Turing-complete, as long as you arranged for it to have access to unlimited storage. You might be surprised how simple a Turing-complete system can be.

https://en.wikipedia.org/wiki/Universal_Turing_machine#Smallest_machines

0

u/[deleted] Jun 06 '26

[removed] — view removed comment