# Why Vex?

Vex brings ownership, concurrency, typed compile-time programming, and
data-parallel operations into one systems language. Its value is in how these
features work together: the same program can expose a small application API
and still express storage lifetimes, native interfaces, and target-specific
computation where those details matter.

This guide helps you evaluate that model for a project. The
[capability map](language-status.md) connects the 0.4.0 language surface to
its guides. The [example collection](examples.md) shows how those features
work together in concrete programs.

## Make state changes visible

Immutable bindings are the default. Use `let!` for a binding that changes and
`&T!` for a mutable borrow. Ownership and borrowing connect a function's
interface to the lifetime of the values it accesses.

This matters when a program passes a buffer through several layers: a reader
can distinguish ownership transfer, a temporary view, and permission to
modify the owner. A `Span<T>` remains a view rather than an allocation or a
lifetime extension; a raw pointer requires additional reasoning at the
unsafe boundary.

Start with [Ownership](memory/ownership.md),
[Borrowing](memory/borrowing.md), and [Span](memory/span-t.md).

## Keep application code and systems code in the same language

Structs, enums, generics, and contracts provide ordinary data modeling and
reusable interfaces. `Option` and `Result` make absence and recoverable
failure part of those interfaces. Native providers and typed pointers cover
interoperability without making every caller manage an ABI.

For example, an application-facing wrapper can validate input, call a native
library, and convert its result into a Vex value. The wrapper still needs an
explicit ownership and cleanup contract; selecting an FFI provider does not
make foreign memory safe automatically.

Follow [Your first project](first-project.md), then
[Error handling](error-handling.md) and [Your first native call](ffi-first-native.md).

## Describe concurrency and its lifetime together

`go`, channels, `async fn`, and `await` let you describe concurrent work in
Vex. A useful design also says who owns each task's input, how results are
collected, and what happens on cancellation or shutdown.

Channels are useful when transferring work or results between tasks. Async
functions are useful when an operation may suspend. Neither construct alone
establishes a throughput improvement or freedom from deadlock: capacity,
ordering, shared state, and the runtime on the selected target still matter.

The [concurrency guide](concurrency/overview.md) introduces the model;
[fan-in](concurrency/fan-in.md) develops a concrete completion and
cancellation flow.

## Express data parallelism without promising a machine instruction

Arrays, tensors, masks, and graph functions expose operations that the compiler
can lower through Silicon IR. This makes shape and elementwise intent visible
before machine-specific lowering.

The generated code depends on element type, dimensions, dependencies,
optimization settings, and backend. An array expression is not a promise of
one SIMD instruction, and a graph function is not proof that a workload ran
on a GPU. Compare outputs with a scalar reference, then inspect or measure
the target path you intend to use.

See [SIMD and tensors](simd/index.md), [GPU graph functions](gpu/graph-functions.md),
and [benchmarking](benchmarks.md).

## Reuse typed semantics at compile time

Compile-time evaluation and structural declaration generation allow a program
to compute values and generate typed declarations within explicit boundaries.
This can eliminate repeated declaration boilerplate while retaining normal
type checking. It also introduces a build-time cost that should be measured
when generation becomes large.

Start with [Compile-time evaluation](advanced/comptime.md) and continue to
[Structural declaration generation](advanced/comptime-declarations.md).

## Evaluate Vex for your project

| Your requirement | What to investigate |
| --- | --- |
| A command-line application | Complete the first-project flow, then check the required file, process, and text APIs on the deployment platform. |
| A network service | Check the HTTP/TLS API subset, concurrency behavior, cancellation, resource limits, and protocol tests your service needs. |
| A compute pipeline | Establish reference outputs and numeric tolerances before comparing CPU or GPU throughput. |
| A native-library integration | Verify target ABI, artifact packaging, ownership, callbacks, and shutdown using the actual library version. |
| Reusable libraries | Review generic constraints, exported types, error behavior, and source compatibility for the selected compiler. |
| An existing codebase | Compare the integration and migration cost with the specific benefit Vex would provide. |

A representative vertical slice is more useful than a language feature score:
build a small part of the intended application, exercise its failure paths,
and retain the compiler version, target, inputs, and results. Use the same
algorithm and workload when comparing another implementation. Compiler
architecture, absence of a tracing collector, and source brevity are not
substitutes for measured compile time, latency, memory use, or binary size.

## Further reading

- [Build language tools in Vex](tooling/language-tools.md)
- [Standard library overview](stdlib.md)
- [Platform support](platform-support.md)
- [Versioning and stability](versioning.md)
- [Verification evidence](verification-evidence.md)

<!-- Preserve previously published comparison and decision links. -->
<a id="vex-vs-rust"></a>
<a id="vex-vs-go"></a>
<a id="vex-vs-zig"></a>
<a id="vex-vs-c"></a>
<a id="vex-vs-mojo"></a>
<a id="feature-matrix"></a>
<a id="when-vex-is-the-right-choice"></a>
<a id="when-vex-is-not-the-right-choice-yet"></a>
