Skip to content

D198 (§16.2b.5): value records in a written facade — reads, fills, updates param N - #3215

Merged
ehartford merged 3 commits into
mainfrom
value-records-reads
Nov 10, 2026
Merged

ehartford merged 3 commits into
mainfrom
value-records-reads

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Implements the written-facade half of spec v7.43's 'Value records' (D198, #3173). Three commits.

  • reads param N presents a &T argument; beside nullable param N, Option[&T].
  • updates param N presents a mut parameter (D172) whose place the callee writes.
  • fills param N: the parameter leaves the list, T.zeroed() is passed, and the record joins the result under §16.2b.4's status rule (T; (status, T) without ok; Result[T, E] with one ok; Result[(status, T), E] with several).
  • Refused: not a pointer to one complete record; a resource's representation; a const pointer under fills/updates; described twice; a buffer-paired parameter, in either order.
  • One clause kind (FACADE_CLAUSE_VALUE_RECORD) carrying its word; the one-constant rise in the existing clause table is granted in build/ceremony-allowances.tsv.

Not in this PR: the drafter writing these clauses from proofs (so with get does not use them yet), and the contract view's rows for the clause.

Fixtures: behav_d198_value_record_{reads_updates,fills,nullable_reads}; err_d198_value_record_{not_a_record,updates_const,twice,is_a_buffer,is_a_resource}.

Battery GREEN on 8324183 (with run tools/battery.w in ~/.local/with-staging/vrec, wall 532 s after a green gate; GREEN BATTERY_DONE). An earlier gate on this branch was red on the typed census (one explicit & at a &T parameter), fixed in the last commit.

Eric Hartford added 3 commits November 9, 2026 21:20
…acade

Spec v7.43 'Value records': a pointer parameter to one complete record
that is not a resource's representation is described by what the callee
does with the record. The facade grammar reads `reads`, `fills` and
`updates param N`; the checker requires a pointer to one complete
record, refuses a resource's representation, a const pointer under
`fills`/`updates`, a record that is not zero-valid under `fills`, and a
parameter described twice; a described parameter is reached through the
presented rendering alone, as a buffer is. The renderer presents a
`reads` parameter as a `&T` argument and an `updates` parameter as a
`mut` parameter (D172) whose place the callee writes. `fills` is parsed
and checked; its rendering is the next layer.

Fixtures: behav_d198_value_record_reads_updates;
err_d198_value_record_{not_a_record,updates_const,twice}.
…ords are one clause kind

`fills param N`: the parameter leaves the list, With passes
`T.zeroed()`, and the record joins what the operation presents under
§16.2b.4's status rule: the record alone when C returns nothing,
`(status, T)` when the status is uninterpreted (no `ok`), `Result[T,
E]` under one `ok` constant, `Result[(status, T), E]` under several.

The three words are one clause kind (FACADE_CLAUSE_VALUE_RECORD) whose
second operand is the word, so the clause table grows by one member,
granted in build/ceremony-allowances.tsv: the table is an existing
numbered-constant run with four readers.

Fixture: behav_d198_value_record_fills (all three result shapes).
…ffer or a resource's representation is no value record

`nullable param N` beside `reads param N` presents `Option[&T]`, None
crossing as NULL. A parameter a buffer clause pairs with a count is
refused under a value-record clause, in either order, and so is a
pointer to a resource's representation (the operation borrows that
resource).

Fixtures: behav_d198_value_record_nullable_reads;
err_d198_value_record_is_a_buffer, err_d198_value_record_is_a_resource.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant