The Nyash programming language introduced in this article is a newborn language with 0 GitHub Stars
What is Nyash, the programming language revolution that will come in 2025?
The title is a bit exaggerated, but please forgive me, as I asked Claude Code to write it!
Note: This is purely a hobby language.
🎯 Introduction – Why Do We Need “One More” Language?
As of 2025, there are hundreds of programming languages. You might be wondering, “Why yet another new language?”
Nyash has a clear answer to that question:
コード スニペット
// 🎁 Would you like to experience this “packing into a box” feeling?
box User {
init { name, email }
pack(userName, userEmail) { // ← "pack" is intuitive!
me.name = userName
me.email = userEmail
}
greet() {
print("Hello, " + me.name + "!")
}
}
local user = new User(“Alice”, “alice@example.com“)
user.greet() // “Hello, Alice!”
Everything is Box – a simple, intuitive philosophy where everything is a “box.” This is the core of Nyash.
💡 The Appeal of the “Everything is Box” Philosophy
🧠 Dramatically Reduced Cognitive Load
In traditional languages, concepts are scattered: “primitive types,” “objects,” “functions,” etc.
JavaScript
// JavaScript: A mix of complex concepts
let number = 42; // Primitive
let string = “hello”; // Primitive
let object = { x: 1 }; // Object
let array = [1, 2, 3]; // Array object
let func = () => {}; // Function
In Nyash, everything is a Box:
コード スニペット
// Nyash: A consistent “Box” concept
local number = new IntegerBox(42) // Number is a Box
local text = new StringBox(“hello”) // String is a Box
local data = new MapBox() // Object is a Box
local items = new ArrayBox() // Array is a Box
local console = new ConsoleBox() // Functionality is a Box
🔧 Unified Method Invocation
Since everything is a Box, the methods of operation are also unified:
コード スニペット
// The same pattern for any Box
number.add(10) // Numeric operations
text.length() // String operations
data.set(“key”, “value”) // Map operations
items.push(number) // Array operations
console.log(text) // Console output
There’s no need to be conscious of “objects,” “functions,” or “primitives.” Everything is a Box, everything is the same.
🌟 Nyash’s Innovative Features
🔄 Explicit Delegation – The Next Generation of Inheritance
Solving the problems of traditional inheritance with explicit delegation:
コード スニペット
// 🔄 Explicit and clear delegation
box AdminUser from User {
init { permissions }
pack(adminName, adminEmail, perms) {
from User.pack(adminName, adminEmail) // Explicitly call the parent's method
me.permissions = perms
}
override greet() {
from User.greet() // Execute the parent's greet
print("(Administrator)") // Add extra functionality
}
}
from syntax: Makes it clear where and what you are calling
override: Explicitly declares a method override
No hidden magic: All behavior is visible
📝 Strict Variable Declaration – Ensuring Memory Safety
コード スニペット
static box Calculator {
init { result, memory } // 📝 All variables are explicitly declared
calculate() {
me.result = 42 // ✅ Previously declared
local temp // ✅ Local variables are also explicitly declared
temp = me.result * 2
// undeclared = 100 // ❌ Compilation error!
}
}
Memory safety and asynchronous safety are fully guaranteed at compile time.
🚀 Practicality – Real-World Application Examples
🎲 Dice RPG Game
コード スニペット
box DiceRPG {
init { player, monster, random }
pack() {
me.player = new MapBox()
me.monster = new MapBox()
me.random = new RandomBox()
me.player.set("hp", 100)
me.player.set("attack", 20)
me.monster.set("hp", 80)
me.monster.set("attack", 15)
}
battle() {
loop(me.player.get("hp") > 0 and me.monster.get("hp") > 0) {
// Player's attack
local damage = me.random.range(10, me.player.get("attack"))
local monster_hp = me.monster.get("hp") - damage
me.monster.set("hp", monster_hp)
print("Player deals " + damage + " damage!")
// Win condition check
if me.monster.get("hp") <= 0 {
print("Victory!")
return
}
// Monster's attack
damage = me.random.range(5, me.monster.get("attack"))
local player_hp = me.player.get("hp") - damage
me.player.set("hp", player_hp)
print("Monster deals " + damage + " damage!")
}
print("Defeat...")
}
}
// Run the game
local game = new DiceRPG()
game.battle()
📊 Statistics Calculation App
コード スニペット
box Statistics {
init { data, math }
pack() {
me.data = new ArrayBox()
me.math = new MathBox()
}
addData(value) {
me.data.push(value)
}
calculateMean() {
local sum = 0
local count = me.data.length()
local i = 0
loop(i < count) {
sum = sum + me.data.get(i)
i = i + 1
}
return me.math.divide(sum, count)
}
}
local stats = new Statistics()
stats.addData(10)
stats.addData(20)
stats.addData(30)
print(“Average: ” + stats.calculateMean()) // 20.0
🔧 Technical Appeal – Robustness through Rust Implementation
💪 Memory Safety
Nyash is implemented in Rust, ensuring:
Prevention of memory leaks: Automatic memory management via the Arc<Mutex> pattern
Avoidance of data races: Thread-safe Box implementation
Type safety: Compile-time type checking
🌐 Three Execution Backends
Bash
For development and debugging (detailed logs)
nyash program.nyash
For high-speed execution (MIR optimization)
nyash –backend vm program.nyash
For Web distribution (WASM generation)
nyash –compile-wasm program.nyash
One language allows you to choose the optimal execution method from development to production.
⚡ Phenomenal Performance
Latest benchmark results (average of 100 runs):
Backend Execution Time Speed-up Factor Use Case
WASM 0.17ms 280x Web distribution, high-speed execution
VM 16.97ms 2.9x Production environment
Interpreter 48.59ms 1x Development, debugging
Technical prowess that achieves a 280x speed-up.
🎮 Get Hands-On
Installation
Bash
Assuming Rust environment
git clone https://github.com/moe-charm/nyash
cd nyash
cargo build –release -j32
Run Hello World
./target/release/nyash examples/hello.nyash
Also Runnable in the Browser
Bash
Generate WASM
./target/release/nyash –compile-wasm hello.nyash -o hello.wat
Run in browser (WebAssembly)
Check with wasm_demo/index.html
🚀 Future Outlook
Phase 8: Native Execution Optimization
WASM optimization: Execution speed comparable to native
Box operations: Full object-oriented programming support
Asynchronous processing: nowait/await syntax implementation
Practical Application Development
NyaMesh: P2P communication library (Nyash's ultimate goal)
WebGUI: Browser application development
Game development: High-performance game engine integration
💭 Conclusion – The Future Nyash Envisions
Nyash is not just “one more language”:
🧠 Reduced Cognitive Load: Ease of learning through the "Everything is Box" philosophy
🛡️ Guaranteed Safety: Complete memory safety ensured by Rust implementation
⚡ High Performance: Optimization technology that achieves a 280x speed-up
🌐 Practicality: A consistent development experience from creation to Web distribution
🔄 Explicit Nature: Transparent programming with no hidden behaviors
It is a language that presents new possibilities in programming language design.
:::message alert
Please: If you are interested in Nyash, please click the GitHub Star⭐ button!
Let’s spread the word about this hidden gem of a language with 0 stars!
:::
Related Links:
If you liked this article, please support me with a follow, like, or comment!