
May 27 marks 10 years since
Ryan Dahl released the very first version of
Node.js. Over the past decade, the project has become more than successful, but Ryan himself has already switched to other things. What is he doing now? How can its new project help JavaScript developers? What does he think about different languages, education, and generational change?
On May 25, two days before the round date, Ryan will speak in St. Petersburg at our HolyJS conference. In the meantime, members of the HolyJS program committee
Evgeny bunopus Kot and
Dmitry dmitrymakhnev Makhnev questioned him in detail about all of the above. On Medium, we published an
English version of the interview, and for Habr we made a Russian version.
Eugene : Many readers already know you thanks to Node.js, but could you tell us a little about yourself?
')
Ryan : I come from San Diego, California. At university I studied mathematics, and my specialty in graduate school at the University of Rochester was algebraic topology. But after three years, I thought: “What do I spend my life on? This is too strange and abstract things. ”
So I left graduate school, went traveling, and after a while I was dragged out by programming. I think many people have done this. In the mid-2000s, I was involved in web development. At first, I liked Ruby on Rails and Ruby in general. As for the Node, then it was lucky to be in the right place at the right time. Coincidentally, I thought about the relevant issues just when Node became possible.
Eugene : So it was good luck? Or did you have a certain vision of this project, and from the very beginning you assumed that it would be super-successful?
Ryan : Will a person work on a project if he doesn't hope that he will be successful? Of course, most often these hopes are not met. We give up and start doing something else - this is what happened with all my projects, except for one. With Node, I was definitely lucky. Then Chrome just came out (and with it the V8), and I thought a lot about non-blocking I / O and how they can be represented by web frameworks, and all this was fine with JavaScript.
Eugene : Now you are practicing
Deno . Can you talk about current work and future plans?
Ryan : My old colleague
Bert Belder and I are trying to create a startup. Over the past year and a half, we have already worked with him on several projects, one of them is Deno. Bert played a big role in the development of Node, he did most of the work on porting Node to Windows. In addition, he is one of the authors of
Libuv .
Eugene : Do you think Deno is expecting a major success in the near future? Will you continue working on it, say, in five years?
Ryan : I have no idea whether Deno will exist in five years - most likely not, because most projects end in nothing. But so far, Deno captures me and gives me job satisfaction.
I think at the moment I am not satisfied with the state in which there are dynamic languages. I lack a fast, convenient and sufficiently universal tool. Both Node and Python are good, but I find them unnecessarily complex or poorly designed in some respects. So ultimately, I'm trying to make a tool for my own workflow.
Evgeniy : While we were preparing the questions, read the
interview on the Mapping the Journey website. There you said that you work with machine learning. And soon after that, they took
Deno at the JSConf EU. So your interests have shifted?
Ryan : In recent years, I've been messing with machine learning algorithms. I will not go into the details of the project I was working on right now, but it was a framework for machine learning in JavaScript. Because of this, I tried Node for the first time in years, and this clarified some of my problems with Node. This led to the presentation at JSConf, in which the Deno prototype was shown. Then a huge interest was shown to the project, so Bert joined. And we continued to work on it. And later I will return to those ML-projects.
I especially want to connect Deno to WebGL. As you probably know, Deno runs on V8, which, in turn, is part of the vast world of Chrome software infrastructure. Chrome has an Angle library that implements WebGL. Connecting to this would allow Deno to program the GPU. A GPU is necessary for training models of many modern neural networks. I would really like Deno to provide me with the desired process of working with mathematical programming. I believe that a significant part of the problems in statistics and mathematics in general are reduced to a kind of data games, and it is very convenient to do this with dynamic languages.
Generally speaking, there are not so many dynamic languages in the world, especially when it comes to popular and fast. So JavaScript is great for defining a model. In many cases, the calculations will be transferred to the GPU, so the speed of the dynamic language or your runtime will not be so important. In general, I plan to return to all these things sooner or later, but so far my attention is focused on Deno.
Dmitry : Is Deno ready now for use in production? Are you aware of interesting cases of real use of Deno?
Ryan : It seems to me that different people have different pain thresholds. If you are ready to live with bugs, lack of documentation and changing APIs, then for some tasks Deno can be used even today. But in general, he is not yet ready for production. It is now in version 0.3, and I will designate 1.0 as the version that I consider appropriate for use by other people. This is a fairly large-scale project, we are creating a new platform. For this you need to do a lot of work, and we try to make it properly. However, if you are a hacker, you are not afraid to get your hands dirty and leave a question or pull request when confronted with a problem - then it can be used.
Evgeniy : What should I add to Deno so that companies start using it in production?
Ryan : In the case of Deno, we focus on situations other than Node.js. We try to provide lower-level access to the computer. In particular, we want Deno to be imported as
Rust crate and so that it can be embedded into other systems.
Suppose you have your own web server or serverless system, and you want to give your customers the ability to execute JavaScript. You may not want to go down to the V8 level, the raw V8 will give you a little. We need some infrastructure, but a full-scale runtime that someone on a desktop computer might have is too much. We hope to cover this “embedding” scenario. We are still working on how the API should look like. We also have performance issues that we
monitor . We need to provide better documentation. In general, there is work to do.
Dmitry : One of the tasks of Deno is built-in support for TypeScript. Recently, TypeScript has spread quite widely, many companies began to use it not only in the browser, but also for Node.js. I heard that people from Node.js ore team also praised him. Do you think that TypeScript can ever replace JavaScript in browsers and get its own runtime (perhaps with a virtual machine)?
Ryan : One of the advantages of TypeScript is that it is a superset of JavaScript, so it will not replace it. What I can really imagine is that TypeScript will fall into standards, and optional types will appear in JavaScript, but this will happen very soon.
Dynamic languages are very useful for initial development, for example, when you prototype something. The advantage of TypeScript (and the idea of optional types in general) is that as the prototype gradually matured, implementation can be gradually “twisted” by annotating the code with types. This does not have to happen at once, so it is possible to move very quickly and to outline new ideas in JavaScript.
I do not know whether it is possible to use types in a V8 virtual machine for runtime optimization. It sounds very difficult, and I do not have enough competence to say whether there will be a significant gain here. In Deno, we use a TypeScript compiler implemented in JavaScript. You can imagine a Rust implementation of a compiler that translates to JavaScript faster. This is possible, the
swc project is working on it.
Eugene : Can TypeScript replace JavaScript? Suppose in the version ES ES 2020 TypeScript will be merged into one language with JavaScript.
Ryan : Yes, types may well be added to the standard. Does TC 39 seem to regulate javascript standards? As far as I know, so far this possibility has not been discussed. But I think before that for a long time, even though it is possible.
Eugene : Do you know Dart? Have you ever used it? What do you think about him?
Ryan : I tried it out of curiosity, but that was a long time ago. Dart goals are similar to TypeScript - it is a dynamic language with optional types. As I already said, this makes it very convenient to organize the workflow. But, unlike TypeScript, Dart is not a superset of JavaScript, it is a different language. Perhaps because of this, it spreads much slower.
True, Flutter has gained some popularity now, so maybe I’ve been behind the times here. Anyway, TypeScript managed to achieve the same goal without creating a new language.
When a new language appears, it is easy to arouse curiosity, but to get people to use it is much more difficult. It is necessary that the benefits were very significant. For example, I was skeptical about Rust for a very long time. It seemed to me that everything that he can already have in C ++, which I actively use. Only recently I got to know Rust more closely, and it became clear that for me it can easily replace C ++. In general, for a new language to become successful, it needs to be an order of magnitude better than the old one.
Eugene : With tongues - like with cars, anyway, sometimes you will take a bus.
Ryan : Exactly.
Eugene : With all the popularity of TypeScript, JavaScript is now generally everywhere: on the backend, in the frontend, on mobile devices, in React Native, Raspberry Pi, and so on. Apparently, we have a revolution, and there was one language that can do everything. Is it really so? Or will there always be special languages for special tasks?
Ryan : JavaScript is just that interesting and works everywhere. But here it is worth noting that while many perceive TypeScript as a separate language, it is compiled into JavaScript. So, from my point of view, TypeScript also works everywhere. In general, I agree with your statement. Of course, in the foreseeable future, JavaScript will remain the language of browsers and a multitude of devices. Therefore, I continue to use it - it gives a very wide range of possibilities.
Dmitry : Don't you think that this popularity of JavaScript can be for the worse? The web has now become an indispensable platform for any service, and JavaScript is the only language in which you can write web services in production. Perhaps it would be better if we had a choice, and all the platforms were not sharpened for one language? Perhaps we need different virtual machines in browsers?
Ryan : I think that was the reason for the popularity of Wasm. On it, you can compile, say, Rust into code that can be executed in a browser.
It sounds awesome, but I wonder how well it works for languages with garbage collection or other runtime tools. Although it may technically be possible to use Python through Wasm to create a site, I suspect that the result will be cumbersome and slow. I think only experience will show here.
Dmitry : So if I want to use something instead of JavaScript, do I need to learn a language that can be transported to Wasm?
Ryan : Or in javascript. The fact is that JavaScript has a garbage collector and many other things. Therefore, if you use a dynamic language, it seems more reasonable to translate into JavaScript than to compile into Wasm, and at the same time to compile all your runtime, including the garbage collector and so on. You will have to invest a lot of resources, although the V8 will probably do better with garbage collection. But yes, Dart is compiled into JavaScript, and you can write web sites on it. There are other languages that do the same.
Dmitry : Since we started talking about different languages, what old or new language would you find interesting to learn in 2019?
Ryan : I really like Rust. There are many interesting findings in it, for example, the idea of a single variable object. It has an excellent compiler, which gives an extremely optimized code. But to understand Rust is very difficult. It took me several months to understand what was happening there. In general, Rust is a very interesting language, but by no means universal.
If you are just writing an application, then most likely you will write it not on Rust, but on something more simple: Ruby, JavaScript or Python. But there are some situations where Rust does its job brilliantly. For example, it is great for writing databases, web servers, or, in our case, virtual machines. It gives you complete control over everything that happens in your code, but at the cost of complexity, which turns out to be open to the developer.
Rust is a new word in writing low-level code, it has significant advantages over Go. Go has a garbage collector, so it’s great for high-performance servers, it's concise and writing is very simple. However, there are cases where the presence of a garbage collector may be a minus, not a plus. In Deno, for example, such a case. We wrap the V8, which already has a garbage collector. It would have turned out two collectors in one process, and their interaction can be catastrophic. V8 and so monstrously complex in itself. In general, for our purposes Rust is perfect. It will be interesting to see what new applications will be found for Rust, when it can be compiled into Wasm.
Dmitry : And what do you think about the growing popularity of functional languages? For example, Elm for the frontend, or Idris.
Ryan : I haven't tried one or the other, so I can't say anything about them.
Eugene : What about functional languages in general?
Ryan : The functional style is quite good. This does not mean that the entire application should consist solely of map, reduce, and the like. There are situations when it is easier to work in imperative style and easier to read. In Rust and JavaScript, both approaches are very well combined, so limiting oneself to only one is not at all necessary. Ultimately, the CPU is still imperative, it works on the instructions sent to it. Therefore, it is quite reasonable to think about code in the same paradigm.
Eugene : And in what style is Deno written? Object oriented or functional?
Ryan : Used both. It all depends on the specific goal we are trying to achieve.
Eugene : We have already discussed which languages you prefer, but what about the tools? What is your favorite IDE? Do you write on MacOS or Linux?
Ryan : I write in vim, use iTerm2, and my computer is a small MacBook. I travel a lot and because of this I often work on a laptop. At a certain point, I noticed that after working behind a large monitor, it was very painful for me to change to a laptop. Therefore, I taught myself to work at a laptop all the time.
I have a Linux system unit at home, I connect to it via SSH. I am rather old-fashioned in choosing tools, mostly UNIX-like things. I use LLDB for debugging.
I worked in Visual Studio Code, but now we are writing our own platform, so there are not many integrations that you get used to expect from the IDE. Usually such things are not connected with what I work on, and as a result, all this only distracts me. I'm used to working with “bare code”, this is especially convenient when developing low-level software. I think if I wrote a website or application for a popular platform, I would use Visual Studio Code.
Eugene : In general, you are an old school programmer.
Ryan : I guess so.
Eugene : Then the next question will be about the school. Apparently, basic programming skills in the near future will be learned in school along with math, English and other subjects. What do you think of it? Perhaps, in a somewhat more distant future, machine learning will also be included in the school curriculum?
Ryan : I have been programming for the past 15 years, and during that time our community has grown a lot. In 2005, it seemed to me that I missed all the most important things, although by today's standards we were still few. And now programmers are everywhere. Obviously, programming has grown into a large audience. It has become an important skill for a large number of people. And given that, yes, programming is worth teaching in high school. But about machine learning, I think that more fundamental things are more useful for high school students.
It seems to me that in the lessons of mathematics it is worth more actively studying statistics. In the US, in high school, students go through algebra, quadratic equations, the beginning of mathematical analysis, derivatives, and the like. Algebra and matane occupy the main part of the program, and then very few people use them regularly. But to be able to process statistical data is required for very many professionals.
As for machine learning, it is still at an experimental stage. It is unlikely in ten years there everything will look the same as now - this area is changing too quickly.
Eugene : Since we started talking about the younger generation, we had a tour from school about a week ago in our office. , 15 , , Python Rust. , 2005 , , -, . , YouTube . , .
: .
: , ?
: , . , . YouTube . , . . , , - , . , . .
: , , . ? - , ?
: , , . , . , , . - Rust, , Rust. , : .
: , , — ? - Rust, . ?
: . - ?
: . , , . ? pull requests ? , ?
: . .
: , . YouTube, . - ? ?
: — . YouTube, . Hacker News Reddit, — - . , , - . YouTube . - , . , (, ), YouTube.
: ?
: , . , , JavaScript. — , . . , , . HolyJS. ?
:
2016 , .
:
, NodeJS . . ? ? ?
: , Joyent. , , , . , , Deno, . , Deno.
: , ?
: , , . , , , . , . -, , , . , . , , , , , . , — …
: , V8 Volkswagen Beetle?
: !
: , V8.
: , , . , . , , , .
: . ? , . , . ?
: , . , . . , Facebook Google, . - , — , . , . , . - , .
: IT , « » , . , . , IT , ?
: , « » — , . , . , , . , . .
: . , — , — . , . ?
: . , . .
: . , ?
: . .
: , , ?
: , . , - , — . , — , .
: HolyJS 2019 -. , !
: , .
HolyJS Deno: «Deno, a new Way to JavaScript». , .
- , Online- ( - ). , 24-25 , .