Why These Programming Languages?
Project Mars supports multiple programming languages because different tasks benefit from different tools. This post explores why we chose Rust, Python, R, Julia, and C++ as our primary language runtimes, and how they complement each other in a multi-language notebook environment.
Set up the runtimes
Each language runs in its own session, so each needs its own toolchain on your PATH. Install only what you plan to use:
# Rust — rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && source "$HOME/.cargo/env"
# Python — python3 (3.10+)
brew install python # macOS — or your distro's python3 package
# R — Rscript
brew install r # macOS — or r-base on Debian/Ubuntu
# Julia — julia
brew install julia # macOS — or your distro's julia package
# C++ — clang++ or g++
xcode-select --install # macOS — or install clang/g++ for your distro
Then run mars notebook doctor — it probes every runtime and prints versions or install hints for whatever is missing.
Language Overview
| Language | Primary Strengths | Best For | Project Mars Integration |
|---|---|---|---|
| Rust | Performance, safety, systems programming | High-performance computing, systems, low-level work | Replay-based execution, Cargo dependencies, LSP integration |
| Python | Ecosystem, readability, rapid prototyping | Data science, ML, web development, scripting | Persistent sessions, matplotlib capture, top-level await |
| R | Statistical computing, data visualization | Statistical analysis, bioinformatics, research | .GlobalEnv persistence, plot capture, jsonlite |
| Julia | Performance, multiple dispatch, scientific computing | Numerical computing, scientific computing, HPC | MarsKernel module, MIME bundles, interactive input |
| C++ | Performance, systems programming, libraries | High-performance computing, embedded systems, legacy systems | Replay-based compilation, Conan/vcpkg dependencies |
Why Rust?
Rust is Project Mars's primary language and the foundation of our architecture. We chose Rust for several reasons:
- Performance without garbage collection: Rust provides C-like performance with memory safety
- Type safety: Compile-time guarantees prevent entire classes of bugs
- Modern tooling: Cargo makes dependency management and builds effortless
- Systems programming: Perfect for building developer tools and infrastructure
- Growing ecosystem: Excellent crates for data science, ML, and scientific computing
See Why Rust? for a deep dive into Rust's strengths and how Project Mars leverages them.
Why Python?
Python remains the lingua franca of data science and machine learning:
- Vast ecosystem: NumPy, pandas, scikit-learn, TensorFlow, PyTorch, and thousands more
- Readability: Clean, intuitive syntax that's easy to learn and maintain
- Rapid prototyping: Quick iteration for experimentation and research
- Community: Massive community support and extensive documentation
- Integration: Seamless integration with other languages and tools
See Why Python? for insights into Python's role in data science and how Project Mars supports it.
Why R?
R is the statistical computing powerhouse:
- Statistical foundation: Built specifically for statistical analysis and graphics
- Tidyverse: Modern, consistent data manipulation and visualization ecosystem
- Research standard: Widely used in academia and research institutions
- Domain expertise: Deep domain knowledge in statistics and biostatistics
- Visualization: Excellent plotting capabilities with ggplot2 and friends
See Why R? for a look at R's statistical capabilities and Project Mars integration.
Why Julia?
Julia combines Python's ease of use with C-like performance:
- Multiple dispatch: Elegant polymorphism without complex inheritance hierarchies
- Just-in-time compilation: Near-C performance with dynamic language ergonomics
- Scientific computing: First-class support for numerical and scientific computing
- Parallel computing: Built-in support for parallel and distributed computing
- Growing ecosystem: Rapidly expanding packages for data science and ML
See Why Julia? for an exploration of Julia's unique approach to scientific computing.
Why C++?
C++ provides ultimate control and performance:
- Performance: Zero-cost abstractions and explicit control over memory and performance
- Systems programming: Foundation for operating systems, game engines, and high-performance applications
- Library ecosystem: Extensive libraries for scientific computing, ML, and graphics
- Embedded systems: Critical for embedded and real-time systems
- Legacy integration: Seamless integration with existing C/C++ codebases
See Why C++? for insights into C++'s role in high-performance computing and Project Mars integration.
How Project Mars Supports Multi-Language Workflows
Project Mars is designed as a multi-language interactive notebook that allows you to:
- Mix languages in a single notebook: Use Rust for performance-critical code, Python for data analysis, R for statistics, Julia for numerical computing, and C++ for systems programming
- Persistent sessions: Each language has its own runtime with persistent state across cells
- Seamless interoperability: Variables and data can flow between languages within the same notebook
- Unified output: Rich outputs (tables, charts, images, HTML) work consistently across all languages
- Single document format: All languages share the same
.marsdocument format
Choosing the Right Language
When working in Project Mars, consider these guidelines:
- Use Rust for performance-critical code, systems programming, or when you need type safety and memory safety
- Use Python for rapid prototyping, data analysis, machine learning, and when you need the vast Python ecosystem
- Use R for statistical analysis, data visualization, and when working with statistical models
- Use Julia for numerical computing, scientific computing, and when you need both performance and ease of use
- Use C++ for high-performance computing, systems programming, or when integrating with existing C++ codebases
One notebook, many languages
A .mars document is language-agnostic: each code cell carries its own language in its metadata, so a single notebook can mix runtimes. The five cells below run in their own persistent sessions — Rust on the replay runtime, Python, R, and Julia in subprocess drivers, and C++ via replay compilation — all inside one document. Run them top to bottom and watch each session stay independent.
let greeting = "hello from Rust";
println!("{greeting}");
print("hello from Python")
"python cells share one persistent interpreter session"
cat("hello from R\n")
println("hello from Julia")
#include <iostream>
std::cout << "hello from C++" << std::endl;
Get Started
Explore these languages in Project Mars:
Each language has its own strengths, and Project Mars brings them all together in a unified notebook environment.