[Chicago] Differences between Interpreted and Compiled Languages.

Lewit, Douglas d-lewit at neiu.edu
Mon Aug 10 07:42:56 CEST 2015


Hey guys,

I've been playing around with Ocaml lately.  Definitely an interesting
language.  Very different from Python, although like Python's IDLE and
Anaconda implementations, Ocaml has an interactive "top level" that makes
it easy to try out the effects of various one-liners, etc.  When you
compile an Ocaml file you end up with a bunch of other files.  So if my
source code is FindPrimes.ml, after compilation I can see files like
FindPrimes.cmi and FindPrimes.cmx in my directory.  There's also a
FindPrimes executable in my directory.  (I could have called it something
else, but I think it's more logical and easier to remember if you name your
executables so that they have the same name as your source code.)

Python is radically different.  There's the source file and that's it!  No
linked files or executables or anything like that.

Okay, so here's my question.  I ***THINK*** (and I'm really guessing here)
that interpreted languages interact with the operating system and that's
the end of it.  However, compiled languages go one step farther.  Because
the source file is compiled to native code, I think that a compiled
language interacts with the operating system as well, but also has the
capacity to interact directly with the computer's underlying architecture,
which would explain why compiled languages tend to run faster than
interpreted languages.

Interestingly enough, isn't Java sort of in between?  It is technically a
compiled language, but the JVM (the Java interpreter) reads the bytecode
file line by line just like Python's interpreter reads the .py file line by
line.  So then Java is not strictly compiled or strictly interpreted;
actually I think Java is both!

Ocaml is definitely kind of cool, but can be challenging.  Ints and floats
cannot be mixed together in the same calculation.  But I think Ocaml has
one huge advantage.  I believe that the language is considered to be very
"safe", meaning that if your Ocaml file compiles then for sure it's going
to run.  So there are no runtime errors in Ocaml, just compile-time errors.
 (Unless at runtime the user inputs a value that is an invalid argument to
some function in the program, etc.)

Best,

Douglas Lewit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20150810/449fe452/attachment.html>


More information about the Chicago mailing list