If sci-fi movies were programming languages
This article was published on the WeChat public account "Cold Writing Science Fiction" on March 12, 2017. It has been reproduced with the consent of the author and has been slightly modified. Interestingly, almost at the same time as this article was published, the MVP design of WebAssembly ended the preview stage and officially entered people's field of vision, and now short videos and webcasts have already eroded everything, and now look at the last paragraph of this article, there may be something different of fun.
In fact, this article is "If Programming Languages Are Science Fiction Movies" (Blatant headline party! Shame!).
I developed a new hobby: looking at the source code of programming languages (compilers, interpreters). For non-programmer readers: This is not learning a new programming language. Learning a new language is a bit like learning to drive a car. What I've been doing lately is kind of like taking cars apart to see how they're made.
So after dabbling in a bunch of programming languages in a mess, I had a whim in the past two days, what would happen if I insisted on taking science fiction movies right? I chose several languages and several movies, and it's not outrageous. The following is the result of the brain hole.
Although it is a joke, the programming languages I choose (including the corresponding sci-fi movies) are all my favorites, or at least I respect them. If your favorite programming language is not among them, there are only two possibilities:
I don't know that language, or can't think of an equivalent sci-fi movie.
I hate that language.
You must think it is the first. That is, you can't take nonsense seriously. Otherwise, I'll pull you to the level of nonsense and beat you with nonsense.
let's go.
1. Python
Python only cares about one thing: making the people who code it happy.
From beginners who have never touched programming to senior programmers who have been coding for many years, Python can be trusted. Simple and clear, flexible and powerful, there is basically no major problem except for the performance (let's not talk about version splitting, it will pass...)
If I had to choose a movie, I would choose The Martian .
The routine is the routine, but the routine is solid; the vulgar is vulgar, but the vulgar boy is not deceived. You haven't all had a good time watching it in the cinema.
Mark Watney is the perfect incarnation of the spirit of Python: he knows how to solve problems quickly and easily, and he is tenacious. Always optimistic, always positive, and with a little bit of a funny temperament. Why is it inconvenient to use as a proof? We are just astronauts, and those advanced mathematics are left to NASA people.
I would want to be friends with him.
(Since I chose Python, I won't choose Ruby, mad at you Rails party :)
2. C++
It has to be Bad Pacific .
Iron armored fist, with three heads and six arms, fangs and long tail, with its own biochemical weapons, it will change into a pair of wings when you are not paying attention.
Although there seems to be a serious sci-fi kernel (C language), if you look at it calmly, no one with normal brains will design a monster like C++. . I understand, I understand, it's not all forced by you guys, do you think Bjarne (C++ author) has a better life. . C++ is a language that has been kidnapped by its great success. No, the director of the second part of "Bad Pacific" has changed, and Brother Fatty is no longer filming.
But so what? Just be careful, it's so powerful and so problem-solving.
play music! Play the little iron armored ship again to fight the little monsters! !
Oh~~~ also~~~
3. Rust
"Ghost in the Shell" .
Rust has been polished for ten years and became famous once. "The Shell" is also accumulated over the years in the TV version, and the movie version is astonishing.
Rust is a system language running on Bare Metal. Attack in the Shell also discusses ontological issues such as time and reality. The focus on system security is also in line with one of Rust's core design principles. It is no wonder that many people are now arguing It is said that we should use Rust to completely rewrite the underlying systems of the operating system, network protocol stack and encryption protocol stack. And Rust's beautiful type system inherited from ML (described later) often reminds me of the beautiful philosophical speculation in "Beat the Shell".
If we remove the fear and love of our neighbors who are stripped of water, that is, the Kaiju Film (monster film), we will discuss the alienation of the human body and human nature by technology. There are also some similarities in the core and form, or it is not unreasonable to say that "Huan Tai" is a universal version of "The Shell".
Just like I always feel that Rust is what C++ should be...
4. Lisp
Humanity may never be able to get rid of this evil thing that appeared in the 1970s.
The programming languages that appeared at the same time have passed away one by one, and only Lisp is still standing, and it continues to teach us what programming is and what is a programming language to this day.
Retired entrepreneurial genius Paul Graham once said that for decades, every time he opened "The Construction and Interpretation of Computer Programs", he would get new insights from it. Another, more extreme statement: any sufficiently complex C or Fortran project has half a mess of Common Lisp implementations. (Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.)
Lisp has a few rules that can be counted with two hands, covering all computational constructs. The corresponding sci-fi movie is definitely "Dike" .
The film is only 28 minutes long, has almost no action shots, and is basically a "slideshow movie". But just like Lisp, it takes "less is more" to the extreme, a metaphor with infinite interpretation possibilities, an infinite recursive structure, and the connotation keeps growing with each review.
5. ML
This is a family of languages, SML, OCaml, F#, ReasonML, Elm, PureScript, Haskell (Haskell fans may not be satisfied and feel that they should list a separate one. In fact, I can also think of sci-fi movies that correspond to Haskell alone, but those " Almost no one has seen the slanted literary sci-fi films of "pretending to be pure", so I will make you feel wronged).
2001: A Space Odyssey reinvented the genre by completely adapting the B-level sci-fi film of The Powerhouse. I will not talk about the significance of ML to the type system. Basically, ML is synonymous with the type system, which started the research in the following decades.
When it comes to film and language itself, they are also epitome of elegance (can you think of anything more harmonious and beautiful than ADT and pattern matching), more is more, less is less. Powerful and mathematically rigorous at the same time, it is impossible to say anything.
Both are, and you can find traces of them from countless latecomers.
6. Erlang
Erlang has to be "Close Encounters" because they are both grossly underrated.
Erlang is actually probably the best implementation of Alan Kay's "object-oriented thinking". When the program is complex enough, you shouldn't care about how the program works as an "entity", but you should isolate the program into different modules, and then completely give up caring about what is inside the module, and instead care about the relationship between modules. Each module is a finite state machine, a virtual machine, a computer. They communicate with each other through "information" and change their state.
"Contact in Time and Space" is also a story of "communication". If each civilization is a module, a "black box", then how should civilizations communicate. The screenwriter of the story is the great scientist and popular science writer Carl Sagan, and the director is the former American teacher Zenmeckis ("Forrest Gump").
I recommend every sci-fi fan to watch "Contact" and every programmer to learn Erlang. Don't be put off by the seemingly obscure expressions of the movie, or the seemingly weird syntax of Erlang. Once you really understand them, you will find a rare wisdom and grace in them.
7. Prolog
What a wonderful world if your program is a bunch of logical constraints and the computer can tell you the answer by itself. Logic programming, represented by Prolog, is such a paradigm.
For the corresponding sci-fi movie, I choose "The Initiator" . This complex time travel story is the result of layer upon layer of "limitations" of the timeline. The director seems to be a programmer. It is said that the script is actually strictly like a paper. There are reasonable explanations for all the things that ordinary people don't understand.
So I don't know much about "Initiator" now, and I don't know how to learn Prolog.
8. Idris
In the beginning, there was the world of terms, and the world of types. It seems to go back and forth until there is a dependent type.
In the beginning, there was the real world, and there was the virtual world. It seemed to stop at Gibson's novels until The Matrix .
Idris may not be able to achieve success in the traditional sense, but the direction he represents has allowed us to see a possible future programming language: unified term and type expression, self-contained proof system, free property-based test.
Watching "The Matrix" again today, I will feel that the special effects are a little outdated, but in any case, it once told us what the future sci-fi movies will look like.
9. Java/C#
The Java party and the C# party who are poking around all day long, admit it, the things you love are actually the same language...
Someone in the tavern clapped the table and shouted: Who dares to be better than me? ! Another slaps the table: Me! The first person took the second person with one arm: Who dares to be better than the two of us? ! No one else spoke. Isn't that the case with Java and C#, the most common language used in engineering today (if the C/C++ party is not satisfied, I will move a small bench to watch the show).
So if it corresponds to science fiction movies, it can be anything other than the "Star Wars" series.
Rich in content, there are spaceships for spaceships, aliens for aliens, and advanced features such as lightsabers and the force. With the most fans and the greatest influence, the ecosystem is vast, and there are as many as three generations of bankruptcy.
But like "Star Wars", this thing looks a bit outdated, the problem is not the language itself, but the object orientation. A Moore's Law dream was awakened, and many people found that Java-style object orientation did not seem to solve those really difficult and important problems.
Alan Kay says that Java's object-oriented design is fundamentally misguided (well, I said Erlang). "Star Wars" is the same, this is actually a family ethics drama that has gone wrong!
Why there are only nine, is this to kill obsessive-compulsive disorder?
of course not.
10. JavaScript
Because of the tenth JavaScript, I really can't think of a corresponding movie. Because this language is so "rotten", it's dazzling and beautiful (a language that doesn't even have integers, how seriously do you want me to take it).
If I had to be right, I would say web video and live video. The scene is special and irreplaceable. You can continue to hold on to the classic movie, you can call it bad, but it is already 2017, and most reasonable people will not deny that this is the direction. It's not that we're going to make JavaScript more like those "serious" programming languages, but those serious programming languages are going to be closer to JavaScript. Almost every programming language that bills itself as "advanced" today has a story of compiling to JavaScript as proof.
Gary Bernhardt once "predicted" in his famous funny speech "The Birth & Death of JavaScript": one day someone will directly embed the JS virtual machine into the Linux kernel, and on that day, Native Code will die out completely . Although it is a joke, the deep meaning is not exaggerated.
JavaScript must die! JavaScript will live forever!
last last, as always
PHP is the best programming language!
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!