# gizlang:live

State that survives code changes. Under `giz live`, each new generation of the program sees the same named state; when the state's type changed, fields whose name and type are unchanged keep their values and the others start from `initial`.

```gizlang
import * as Live from "gizlang:live";
```

## Functions

### `state`

```gizlang
function state<T>(name: string, initial: T): Ref<T>
```

The value cell NAME, kept across live reloads of the program: its first use makes it with INITIAL.

### `generation`

```gizlang
function generation(): i64
```

The number of the newest live generation: 1, 2, ... under `giz live`, 0 elsewhere. A program that keeps a value made at its
start sees by a changed number that a new generation took over.

Effects: read.

### `reject`

```gizlang
function reject(): bool
```

A deployed host withdraws the generation that runs, because it cannot start (its startup failed): the one before it serves again.
Whether it did; false on a development host and outside a live host.

Effects: write.

### `buildError`

```gizlang
function buildError(): string
```

Why the newest edit did not build under `giz live`: the compiler's diagnostics, as the terminal shows them.
Empty when it built, and outside a live host. A development page shows it until an edit fixes it.

Effects: fail, read.

