Concrete
Rulescontract

concrete/contract/reads-acyclic

No slot reads itself through its sources, rows and reads.

No slot reads itself through its sources, rows and reads.

Graded by the contracts stage of concrete check, in the contract venue. A violation reports this id and the file it failed at — see every rule and concrete check.

Reason

Every read inside a section is an edge to something that must settle first: a member read to its row, a list or row sourced by a slot to that slot, a compute's or a fill's reads to the slots they name. A row has to resolve before the slots that read it, and an item's fields can only be filled in the order their reads impose.

A cycle has no first slot to settle — each value waits on another that waits on it — so it can never resolve. The violation names every slot on the cycle.

Check-caught. Two consts that read each other cannot both be declared, so a cycle through them does not compile; the rule holds the cycles the types cannot see, and a schema assembled outside the builders.

Fix

Drop one read on the cycle, or source one of its slots from somewhere outside it.

Before and after

// Each row reads the other, so one is used before it is declared: this half does not compile.
// @noErrors
import { fact, fill, object, row } from "@homepages/concrete";

const pair = row({ label: "Pair", from: fact.property.comparables, source: fill.pick({ reads: [rival.price], brief: "…" }) });
const rival = row({ label: "Rival", from: fact.property.comparables, source: fill.pick({ reads: [pair.price], brief: "…" }) });
object({ fields: { pair, rival } });
import { fact, fill, object, row } from "@homepages/concrete";

const pair = row({ label: "Pair", from: fact.property.comparables });
const rival = row({ label: "Rival", from: fact.property.comparables, source: fill.pick({ reads: [pair.price], brief: "…" }) });
object({ fields: { pair, rival } });

On this page