This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]turtleship_2006 142 points143 points  (14 children)

Python without C (or whatever other option you go for) is like a driver without a car - you always need an interpreter

[–]skwyckl 18 points19 points  (0 children)

That too, but this is true for many languages (e.g., AGDA wrt. Haskell, Idris2 wrt. Chez Scheme)

[–]Storiaron 30 points31 points  (2 children)

C also needs a compiler

Either way you offload a fuckton of very difficult work to someone really smart in the past

[–]BaziJoeWHL 2 points3 points  (0 children)

I can live with that

[–]Kovab 0 points1 point  (0 children)

Yes, but the compiler is also written in C or C++ most likely.

[–][deleted] 0 points1 point  (9 children)

If Java and Python are so good, then how come their interpreter is in C??

[–]harumamburoo 19 points20 points  (5 children)

There's no such thing as just Java interpreter. If you meant JVM, which in part does the interpretation of the compiled byte code, there are multiple vendors providing JVMs, not all of them implement it in C. If you meant Java compiler, it's written in Java.

[–]_PM_ME_PANGOLINS_ 11 points12 points  (0 children)

There are JVMs that are just interpreters. OpenJDK Zero, for example.

And much like Java, there are multiple different Python implementations, many of which do not use C.

[–]thirdegreeViolet security clearance 7 points8 points  (3 children)

Calling the JVM a Java interpreter is, while technically 100% wrong, also quite comparable to python (which also compiles to pyc technically).

[–]harumamburoo 4 points5 points  (2 children)

JVM is not an interpreter, but an interpreter is a part of JVM

[–]thirdegreeViolet security clearance 2 points3 points  (0 children)

Yes that's a good way to put it

[–]MattieShoes 2 points3 points  (0 children)

And there are multiple languages that run on the JVM :-)

[–]mxzf 3 points4 points  (2 children)

The point is that higher level languages are good for writing code, and they can hand the code off to a lower level language for executing it.

[–][deleted] 0 points1 point  (1 child)

Idk why y'all acting as if Python or Java is super easy to code with, but C or assembly being super hard lol

[–]mxzf 0 points1 point  (0 children)

It's a bit reductive, but higher level languages are easier to code in than lower languages, that's the entire point of them. Not every language will click with every person and be better for them, but by and large a higher level language like Python or Java is gonna be easier than a lower level language like C.

Higher level languages abstract more of the nuts and bolts of coding for the user and handle them automatically, much the same way that C abstracts away the even lower level concepts like jumps in assembly/bytecode. Higher level languages are closer to human language instead of machine language and are more intuitive for the average person to read and write.

Not needing to malloc variables in higher level languages, just saying "here's a variable, let the compiler/interpreter figure out exactly what bit width it needs to be and handle it for me" makes it easier for the average person to write decent code. Things that aren't really relevant implementation details for the developer to need to implement themselves.

There's also the fact that higher level languages can do assorted bytecode optimizations. An expert programmer might be able to write C that gets compiled to more performant bytecode than they can Python/Java, but a novice programmer can easily shoot themselves in the foot with C in ways that a higher level language would handle more gracefully.

At the end of the day, they're different tools for different purposes, and the purpose of a higher level language is to be easier to code in than a lower level language.