# FAQ

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

> Short, honest answers to common questions about Sakura Lang.

## Can I use Sakura Lang today? [#can-i-use-sakura-lang-today]

Yes. `v1.0.0` is the first stable release: what [Stability](/docs/stability) lists keeps working
across 1.x, and a breaking change waits for 2.0. Native, packages and workers are experimental
and may change.

Programs run on JavaScript and WebAssembly. The editor support (LSP), the MCP server and
`sakura verify` work today. Native executables are experimental. Every example project in the
repository runs or passes its tests in CI.

See [Install](/docs/install), [Stability](/docs/stability) for what the release promises, and
[changes on main](/docs/changes).

## What is an effect? [#what-is-an-effect]

Anything a function does besides returning a value: printing, reading the clock, calling the
network, failing. A Sakura Lang function lists its effects after `!`:

This is a signature only, not a whole program.

```sakura fragment
fn load(id: String) -> User ! {Http, Fail<NotFound>}
```

`load` returns a `User`, may make HTTP requests, and may fail with `NotFound`. A function
without `!` does none of these. See [Effects](/docs/tour/effects).

## What is a handler? [#what-is-a-handler]

The code that decides what an effect actually does. The same function can run against a real
database in production and an in-memory list in a test, just by installing a different
handler with `with`. See [Handlers](/docs/tour/handlers).

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

Read it as "and also": `-> User ! {Users, Clock}` returns a `User` and also uses `Users` and
`Clock`. It is short, and it keeps the return type apart from the effects. Leaving out `!`
always means pure.

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

Effect-TS is excellent and shows that typed effects and errors work for real services. Sakura
Lang takes its model directly. The difference is enforcement. In TypeScript the model is a
library: any function can still throw, call `fetch`, read `process.env` or cast to `any`. An
agent under pressure to pass a test 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, not a convention. The language also adds
what a library cannot: refinement types, contracts, permissions in `sakura.toml`,
`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. Koka's effect rows and reference counting, Effect-TS's typed errors,
Unison's plain handlers and compiler MCP server, Roc's platform-owned access, Rust's `Result`
and exhaustive matching, and Go's single toolchain and option-free formatter. The
[prior art](/docs/prior-art) page covers each language, including what Sakura Lang rejects.

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

Any Sakura Lang function may wait, and your code cannot tell whether a call did, so an `async`
label would say nothing. The handler decides: `Clock.sleep` waits under the real clock and
returns at once under a test clock. To run work in parallel, use the `Task` effect. See
[Concurrency](/docs/tour/concurrency).

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

Changing a value that something else also points to causes many hard bugs, and it is why Rust
needs a borrow checker. Sakura Lang has `var`, which lets you give a name a new value, but no
value can change under someone else's feet. `u.email = e` on a `var u` is short for
`u = User { ..u, email: e }`. The compiler updates in place when it can prove nothing else
holds the value, so loops that build lists stay cheap.

## How is memory managed? [#how-is-memory-managed]

You never manage it by hand. The JavaScript backend uses JavaScript's garbage collector. The
WebAssembly backend, and the experimental native one, use reference counting that the
compiler inserts, which gives predictable memory use and no collector pauses.

Values can only refer to values that existed before them, so reference cycles cannot form.
For data that really is cyclic, such as a graph, use `Graph<N>` with `NodeId` keys. See
[Memory model](/docs/tour/memory).

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

It is checked at runtime instead. `run` and `test` keep every check. `sakura build` removes a
check only where `sakura verify` proved it, and only for some kinds of check; an `unknown`
result never removes anything. There is no `--release` flag that turns checks off. See
[Contracts](/docs/tour/contracts).

## Can I call libraries written in other languages? [#can-i-call-libraries-written-in-other-languages]

On the JavaScript backend, yes, through `@external` declarations. Foreign calls perform a
`Foreign` effect that only the host can provide, so `main` must declare it. A foreign exception
becomes a typed `ForeignError`, callbacks passed to foreign code must be pure, and the build
manifest marks such code as `trusted`.

## Is it fast? [#is-it-fast]

Speed is a design goal. The [benchmarks page](/docs/benchmarks) shows the current numbers and
what they measure. Results are specific to those workloads and one machine; they are not a
ranking of languages.

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

No. It uses open formats: Markdown docs and `llms.txt`, JSON Lines errors, and the Model
Context Protocol. Any agent that can run a command or speak MCP can use it. The `Llm` effect is
provider-neutral. Today there is one provider handler, `Llm.anthropic`, plus `Llm.scripted`
and `Llm.replay` for offline tests.

## Will people enjoy writing it? [#will-people-enjoy-writing-it]

That is a goal, but not the first one. Sakura Lang is designed first to be easy for agents to
write correctly and for people to review. Those overlap a lot: a small grammar, no null, no
exceptions and honest signatures are pleasant for people too. Whether effect lists stay
readable in large programs is something the early releases are meant to find out.

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

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]

- Write a small program you know well in Sakura Lang, by hand or with an agent, and
  [open an issue](https://github.com/icantcodefyi/sakuralang/issues) about what was awkward.
- Report anything in the [Language Tour](/docs/tour/basics) or the design that is unclear or
  wrong.
- Point out prior art the design should learn from.
- Language changes go through [RFCs](https://github.com/icantcodefyi/sakuralang/tree/main/docs/rfcs);
  see [CONTRIBUTING.md](https://github.com/icantcodefyi/sakuralang/blob/main/CONTRIBUTING.md).

Details for contributors: the [language design](https://github.com/icantcodefyi/sakuralang/blob/main/docs/design.md)
(§13.6 covers foreign calls) and the [roadmap](/docs/roadmap).
