Introduction: Empirical Language Proof
Why This Book Exists
This is not a typical language tutorial. This is an empirical proof that Ruchy works.
Every feature documented here has:
- ✅ Runnable code you can copy into the notebook
- ✅ Expected output you can verify
- ✅ Automated tests proving it works
- ✅ Coverage reports proving tests are thorough
- ✅ Mutation tests proving tests catch real bugs
- ✅ E2E tests proving it works in browsers
The Promise
If you can run this code in the Ruchy notebook and get the expected output, the language feature works.
No hand-waving. No "coming soon." No "should work."
Just: Here's the code, here's the output, here's the test that proves it.
How to Use This Book
1. Run the Notebook
# Start the notebook server
cargo run --features notebook --bin ruchy notebook
# Or open the web version
open http://localhost:8000/notebook.html
2. Try Each Feature
Copy the code from each chapter into the notebook. Run it. Verify the output matches.
3. Check the Proof
Every chapter links to:
- The automated test file
- The coverage report
- The mutation test results
- The E2E test
If you don't trust the docs, check the tests.
Quality Standards
This book and the notebook are held to wasm-labs EXTREME quality standards:
Coverage Requirements
- ✅ Line Coverage: ≥85%
- ✅ Branch Coverage: ≥90%
- ✅ Mutation Score: ≥90%
Testing Requirements
- ✅ Unit Tests: Every function
- ✅ Property Tests: 10,000+ random inputs
- ✅ Mutation Tests: Empirical bug-catching proof
- ✅ E2E Tests: Real browsers (Chrome, Firefox, Safari)
WASM Requirements
- ✅ Size: <500KB
- ✅ Purity: 0 WASI imports
- ✅ Validation: Deep bytecode inspection
The 41 Features
This book proves all 41 Ruchy language features work in the notebook:
Foundation (9 features)
- Integer/Float/String/Bool/Nil literals
- Variable binding and assignment
- Comments (line and block)
- Arithmetic operators (+, -, *, /, %)
- Comparison operators (<, >, <=, >=, ==, !=)
- Logical operators (&&, ||, !)
- Bitwise operators (&, |, ^, <<, >>)
- If-else expressions
- Match expressions
Functions & Data (11 features)
- For loops
- While loops
- Loop control (break, continue)
- Function definitions
- Function parameters and returns
- Closures and lambdas
- Higher-order functions
- Arrays
- Tuples
- Objects/Maps
- Structs
Advanced (10 features)
- Enums
- Pattern destructuring
- Pattern guards
- Exhaustiveness checking
- Try-catch error handling
- Option type
- Result type
- String interpolation (f-strings)
- String methods
- String escaping
Standard Library (10 features)
- File I/O (fs)
- HTTP client
- JSON parsing
- Path operations
- Environment variables
- Process execution
- Time/Date operations
- Logging
- Regular expressions
- DataFrames
Meta (1 feature)
- WASM compilation
Let's Begin
Ready to see the proof? Let's start with the basics: literals.