2.3 Programming Languages
Last updated
Last updated
Before we discuss the components in detail, let's talk about the programming languages used by Deno. We'll give a brief overview of the languages used in the Deno ecosystem. This will help us understand the components better when we discuss them later.
A significant portion of Deno's codebase is written in Rust, a highly popular and secure programming language.
Rust's robustness adds an extra layer of reliability to Deno's architecture. Various essential elements of Deno, such as the CLI, module graph management, runtime execution, operational functionalities, and core mechanisms, heavily utilize Rust.
Rust is a versatile programming language with multiple styles and applications. It is designed to excel in overall performance, safety in handling data types, and managing tasks running concurrently. Rust ensures memory safety without relying on a garbage collector or reference counting, methods often used in other languages prioritizing memory safety. This is achieved through its "borrow checker," which closely observes the lifespan of object references throughout the program's compilation process. Rust's design incorporates functional programming concepts, including static typing, immutability, higher-order functions, and algebraic data types. These elements contribute to Rust's stronghold in the realm of systems programming, where control over hardware and memory is paramount.
The history of Rust began with Graydon Hoare, who created it as a personal project while working at Mozilla Research in 2006. Mozilla officially backed the project in 2009, recognizing its potential. Since its inaugural stable release in May 2015, Rust has garnered significant adoption from major players like Amazon, Discord, Dropbox, Meta, Google, and Microsoft. In 2022, Rust became the first language, apart from C and assembly, to receive support for Linux kernel development. Rust's rapid growth has caught the attention of academia, leading to its exploration and examination in the realm of programming language research.
The multifaceted nature of Rust has attracted the curious minds of researchers, setting the stage for further advancements and discoveries in the world of programming languages.
While Deno's core codebase is written in Rust, the V8 engine, which Deno uses for JavaScript and WebAssembly execution, is built using C++.
V8 is Google's open-source, high-performance engine for JavaScript and WebAssembly, also built with C++. This powerful engine is used not only in Chrome but also in Node.js and other software. Its main function is to interpret and execute ECMAScript and WebAssembly, essential for modern web development.
V8 is compatible with multiple operating systems, including Windows 7 and later, macOS 10.12 and later, and various Linux systems using x64, IA-32, ARM, or MIPS processors. This broad compatibility allows developers to utilize V8 across different computing environments.
V8's versatility lies in its ability to function both as a standalone entity and as an embedded component within any C++ application. This flexibility enables developers to customize their software solutions while leveraging V8's high-performance capabilities. Whether powering web browsers or enhancing applications, V8's impact is significant in modern software development.
Deno's main runtime code, which users interact with, is written in JavaScript. This code provides Deno's JavaScript APIs, which you can use in your own code. Examples of these APIs include functions like getEnv, setEnv, alert, confirm, and console logs. Additionally, this code includes APIs from the ext component, which adds more utility. This component provides a range of essential user-level functions. These include:
Buffers
File System interactions
Process management,
Signal handling
HTTP communication
User prompts
etc.
This wide range of functions makes Deno versatile and capable of supporting diverse applications.
Initially, Deno's runtime code was written in TypeScript. However, due to certain challenges, the decision was made to switch to pure JavaScript. This change was made to address specific issues encountered during development.