:core — The Monastery
:core — The Monastery
Section titled “:core — The Monastery”“No magic. No surprises. Just code.”
:core is the foundation of Janus. Every other profile extends :core — nothing is removed, only added. If you want to understand how Janus really works, start here. If you want to build something that just works, start here too.
What :core Gives You
Section titled “What :core Gives You”The Honest Basics
Section titled “The Honest Basics”- 6 core types:
i64,f64,bool,String,Array[T],HashMap[K, V] - 8 control constructs:
func,let,var,if,else,for,while,return - No hidden state: Every allocation is explicit
- No implicit concurrency: What you write is what runs
- Native Janus stdlib first: prefer
use std.*; reserveuse zigfor explicit bridge modules or generated wrappers
Type System
Section titled “Type System”- Structural typing with inference
- Generic functions with constraints
- Pattern matching on enums and structs
- No
null— useOption[T]instead
Memory Model
Section titled “Memory Model”- You choose the allocator (
Arena,Pool,Bump, or custom) - No garbage collection — ever
- Deterministic destruction via
deferand explicit cleanup - Memory ownership is always visible in your code
What :core Excludes
Section titled “What :core Excludes”| Excluded | Available In |
|---|---|
spawn, send, receive | :cluster |
async/await | :service, :cluster |
| Tensors and GPU code | :compute |
Raw pointers and unsafe | :sovereign |
| Effects system | :sovereign |
When to Use :core
Section titled “When to Use :core”Perfect for:
- CLI tools and automation
- Embedded systems (ESP32, Raspberry Pi Pico)
- Learning Janus from first principles
- Any project where predictability matters more than convenience
- Libraries that will be used by other profiles
- Systems programming without the unsafe parts
The rule of thumb: If :core can do what you need, stay in :core. The Monastery is a perfectly valid place to live.
Code Examples
Section titled “Code Examples”Hello, World
Section titled “Hello, World”func main() do print("Hello, Sovereignty!")endFibonacci (Explicit Types)
Section titled “Fibonacci (Explicit Types)”func fib(n: i64) -> i64 do if n < 2 do return n end return fib(n - 1) + fib(n - 2)end
func main() do for i in 0..10 do print("fib(${i}) = ${fib(i)}") endendWorking with Collections
Section titled “Working with Collections”func main() do let scores = [ {"alice", 95}, {"bob", 87}, {"carol", 92}, ]
for pair in scores do let name = pair.0 let score = pair.1 if score > 90 do print("${name} earned an A!") end endendError Handling (Manual)
Section titled “Error Handling (Manual)”func divide(a: i64, b: i64) -> Option[i64] do if b == 0 do return .none end return .some(a / b)end
func main() do match divide(10, 2) do | .some(result) => print("10 / 2 = ${result}") | .none => print("Division by zero!") endendThe :core Promise
Section titled “The :core Promise”What you write is what you get. There’s no runtime magic. No hidden allocations. No surprising behavior. When something goes wrong, the bug is in your code — not in some abstraction layer you don’t understand.
This is :core. This is Janus.
Next Steps
Section titled “Next Steps”- Learn the Fundamentals — Go deeper with types, functions, and control flow
- Move to :script — When you want REPL and implicit types
- Move to :service — When you need async and error handling
- Profile Overview — See all six profiles
One language. The foundation is always there.