# FAQ

URL: /docs/faq
Markdown: /docs/faq.md

> Honest answers to common questions about Sakura Lang's status, design choices, and relationship to other languages.

## Is Sakura Lang usable today? [#is-sakura-lang-usable-today]

Not for real work yet. The v0 language is fully specified in [docs/design.md](https://github.com/icantcodefyi/sakura-lang/blob/master/docs/design.md), and the compiler is a Rust workspace in [compiler/](https://github.com/icantcodefyi/sakura-lang/tree/master/compiler). It parses, resolves, type- and effect-checks and runs the core language and substantial M3 functionality on JavaScript. All twelve examples pass their configured modes, with `agent_loop` and `secrets` still check-only. M3 completion, WASM/static verification and native execution remain ahead. See the [roadmap](/docs/roadmap).

## Why not just use TypeScript with Effect-TS? [#why-not-just-use-typescript-with-effect-ts]

Effect-TS is excellent and shows that typed effects and errors work for real services. Sakura Lang takes its application model directly. The difference is enforcement. In TypeScript, the effect system is a library: any function can still throw, call `fetch` directly, read `process.env`, or cast to `any`, and nothing in the language stops it. An agent under pressure to make a test pass will find those exits.

In Sakura Lang, effects are the only way to do IO and `Fail<E>` is the only way to fail with an expected error, so the signature is a guarantee rather than a convention. Sakura Lang also adds things a library cannot: refinement types and contracts, authority limited by handlers and `[permissions]`, `Untrusted<T>` and `Secret<T>`, and compiler-managed memory.

## What does Sakura Lang take from other languages? [#what-does-sakura-lang-take-from-other-languages]

A lot, and it says so. The [prior art](/docs/prior-art) page goes through Koka, Effect-TS, Unison, Roc, Rust, Go, Gleam, Lean, Dafny, Elm, and others, and for each one lists what Sakura Lang takes, what it rejects, and why. In short: Koka's effect rows and Perceus reference counting, Effect-TS's typed errors and requirements, Unison's plain handlers and compiler MCP server, Roc's platform-owned authority, Rust's `Result` and exhaustive matching, and Go's single toolchain and option-free formatter. Sakura Lang is a new language, not a fork of any of them.

## Why reference counting? What about cycles? [#why-reference-counting-what-about-cycles]

On the native backend (milestone M5), reference counting inserted at compile time gives predictable memory use and no collector pauses, without asking the programmer to reason about lifetimes. With Perceus-style reuse, an update to a uniquely owned value becomes an in-place write. The JavaScript backend, which comes first, uses the host GC with identical semantics.

Cycles cannot be built, because values have value semantics: a value can only refer to values that existed before it. Cyclic data such as graphs uses `Graph<N>` with `NodeId` keys. The only stateful constructs are handler `var` state and `Graph`, and both are confined. See [Memory model](/docs/tour/memory).

## Why `!` for effects? [#why--for-effects]

It reads as "and also": `-> User ! {Users, Clock}` returns a `User` and also performs `Users` and `Clock`. It is short and visually separates the return type from the effect row. Omitting `!` always means pure.

## Why no `async`? [#why-no-async]

Every Sakura Lang function may suspend, and nothing in application code can observe whether it did, so an `Async` label would carry no information. Suspension is a property of handlers: `Clock.sleep` suspends under the live clock and returns at once under `Clock.fixed`. Concurrency uses the `Task` effect with structured scopes. See [Concurrency](/docs/tour/concurrency).

## Will humans enjoy writing Sakura Lang? [#will-humans-enjoy-writing-sakura-lang]

That is a goal, but not the primary one. Sakura Lang is designed first to be easy for agents to write correctly and for humans to review. In practice those overlap: a small grammar, no null, no exceptions, and signatures that say what a function does are pleasant for people too. Whether effect rows stay readable in large programs is something the first milestones are meant to find out.

## Is Sakura Lang tied to one AI vendor? [#is-sakura-lang-tied-to-one-ai-vendor]

No. The interfaces are open formats: Markdown docs and `llms.txt`, JSON Lines diagnostics, and the Model Context Protocol. Any agent that can run a command or speak MCP can use the toolchain. The `Llm` effect is provider-neutral; the installed handler chooses the provider. v0 ships one provider handler (`Llm.anthropic`) plus `Llm.scripted` and `Llm.replay` for offline tests.

## Are there performance numbers? [#are-there-performance-numbers]

No. The plan is JavaScript first, then WASM (M4), then native code via Cranelift with Perceus reference counting (M5). Benchmarks will be published when there is something real to benchmark, with the code to reproduce them.

## Why no `mut`? [#why-no-mut]

Mutation plus aliasing is the source of many hard bugs, and it is what forces Rust to have a borrow checker. Sakura Lang has `var` for rebinding a name, but no value can be mutated through an alias: `u.email = e` on a `var u` is sugar for `u = User { ..u, email: e }`, and closures capture by value. The compiler reuses buffers in place when it can prove a value is unshared, so loops that build lists stay cheap.

## What happens when a contract cannot be proven? [#what-happens-when-a-contract-cannot-be-proven]

In v0, nothing is proven by a solver: every `requires`, `ensures`, and `where` clause is checked at runtime in every build mode, including `--release`. A violation is a defect that terminates the task. The planned `sakura test --contracts` will also generate property tests from contracts. From milestone M4, `sakura verify` tries to prove each obligation with an SMT solver; only a `proved` status removes that one check, and `unknown` keeps it. See [Contracts](/docs/tour/contracts).

## Can Sakura Lang call existing libraries in other languages? [#can-sakura-lang-call-existing-libraries-in-other-languages]

On the JavaScript backend, yes, through `@external` declarations. Foreign calls perform a `Foreign` effect that only the host root handler can provide, so `main` must declare it. Exceptions become a typed `ForeignError`, callbacks passed to foreign code must be pure, and any package that uses `@external` is marked `trusted` in the build manifest. See [design §13.6](https://github.com/icantcodefyi/sakura-lang/blob/master/docs/design.md).

## What is the license? [#what-is-the-license]

Dual-licensed under MIT or Apache-2.0, at your option. See `LICENSE-MIT` and `LICENSE-APACHE` in the repository.

## How can I help? [#how-can-i-help]

- Read [docs/design.md](https://github.com/icantcodefyi/sakura-lang/blob/master/docs/design.md) and the [Language Tour](/docs/tour/basics), and open issues on [GitHub](https://github.com/icantcodefyi/sakura-lang) where the design is unclear, inconsistent, or wrong.
- Try writing a small program you know well in Sakura Lang syntax, by hand or with an agent, and report what was awkward.
- Point out prior art the design should learn from.
- Language changes go through [RFCs](https://github.com/icantcodefyi/sakura-lang/tree/master/docs/rfcs); see [CONTRIBUTING.md](https://github.com/icantcodefyi/sakura-lang/blob/master/CONTRIBUTING.md).
