# Design

> UForm's design from C++

4.0.0-rc.1 · c58749fe

- **A thin layer over the C ABI.** One header per C header, `types.hpp`, `model.hpp`, `encode.hpp` and `train.hpp`, behind `uform.hpp`; every name is its C name without `uform_`, and every factory takes its C argument struct by designator.
- **The receiver chooses, the verb stays.** The model runs a verb on the calling thread, `on(executor)` blocks on an executor, and `deferred(executor)` submits it, all with the same arguments.
- **Deferred calls use the language’s own idioms.** `status` polls through `uform_outcome_status`, `wait()` blocks through `uform_outcome_wait`, and `co_await wait(loop)` re-polls through the caller’s scheduler, since the library has no wake-up.
- **No life of its own.** The SDK starts no threads and keeps no queues, counts or caches; destroying a `deferred` waits for the call first.
- **Arenas belong to the caller and are reused, never shared.** Every output verb takes an arena and answers views into it, valid until the arena’s next call.
- **Nothing costs anything until it is used.** A blocking call keeps its outcome and outputs on the stack, a deferred one inside the `deferred` it answers, and awaiting posts two words to the caller’s loop, so the SDK allocates nothing on any path.
- **Suites run against the stub library**, and against the real one with the tiny checkpoint.

| Path | C++ | Rust |
| - | - | - |
| Blocking call | 0 | 0 |
| Refusal before the call | 0 | 1 error |
| Deferred submit and wait | 0: the `deferred` lives with the caller | 0: the `Deferred` is pinned where it is polled |
| Each callback | 0 | 0 |
