Skip to content

feat(ir): drop Function.synchronous, add Function.parameters, KindValue::Unit - #46

Merged
Kinflou merged 1 commit into
masterfrom
feat/ir-function-params-drop-sync
Sep 1, 2026
Merged

feat(ir): drop Function.synchronous, add Function.parameters, KindValue::Unit#46
Kinflou merged 1 commit into
masterfrom
feat/ir-function-params-drop-sync

Conversation

@Kinflou

@Kinflou Kinflou commented Sep 1, 2026

Copy link
Copy Markdown
Member

Three of the four core ↔ target IR changes (docs Design §4.4). The fourth — throws: Vec<String>Vec<u16> with schema-global error ordinals (incl. cross-schema use) — is a separate follow-up PR.

Function.synchronous removed

Conflated three things — a wire fact (does the call reply), a binding choice (block vs .await), server scheduling config. Only the first belongs in the schema and _return already carries it. It was always frozen true and read nowhere.

Function.parameters: Vec<FrozenUnit> added

Same shape Protocol / Struct already carry — @key = value function annotations (@timeout_ms, @idempotent, …) frozen as Property { name, expression } via the existing annotation_units(). The AST already parsed function annotations; they were dropped at freeze. Open namespace — a consumer acts on the keys it knows.

KindValue::Unit + a () type in the grammar

function commit() -> (); now freezes as _return: Some(KindValue::Unit)a reply that carries no value (an empty ack) — distinct from function commit(); (no ->), which freezes as _return: Noneno reply at all (one-way). Without the variant, "ack, no value" was inexpressible without inventing an empty struct per call.

  • New rust_sitter node UnitType (( )); parser regenerates at build time, no ambiguity in the Type position.
  • type_to_string / build_kind_value map it; exhaustive KindValue matches updated in diff.rs, validator.rs, kind_search.rs.

Tests

Parser + IR coverage for -> () vs no return (test_protocol_unit_return, test_protocol_unit_return_ir). Full core suite green — 241 passed, 0 failed. No frozen-unit hash goldens broke.

Downstream

FrozenUnit shape change → every comline-<lang> / generation / cli that pins comline-core needs a coordinated rev-bump when this lands (they only pattern-match Function with .., so it's a rev-bump, not code changes).

…ue::Unit

Three of the four core-target-contract IR changes (docs Design 4.4). The
fourth -- throws: Vec<String> -> Vec<u16> with schema-global error ordinals
-- is its own follow-up.

- Function.synchronous removed. It conflated a wire fact (does the call
  reply), a binding choice (block vs .await) and server config; only the
  first belongs in the schema and _return already carries it. It was always
  frozen `true` and read nowhere.

- Function.parameters: Vec<FrozenUnit> added, same shape Protocol / Struct
  already carry -- `@key = value` function annotations (@timeout_ms,
  @idempotent, ...) as Property { name, expression }. The AST already parsed
  function annotations; they were dropped at freeze. Open namespace: a
  consumer acts on the keys it knows.

- KindValue::Unit + a `()` type in the grammar. `function commit() -> ();`
  now freezes as _return: Some(KindValue::Unit) -- a reply that carries no
  value (an empty ack) -- as distinct from `function commit();`, no `->` at
  all, which freezes as _return: None (no reply, one-way). Without the
  variant "ack, no value" was inexpressible. Exhaustive matches updated in
  diff.rs, validator.rs, kind_search.rs; type_to_string / build_kind_value
  map the new grammar node.

Tests: parser + IR coverage for `-> ()` vs no return. Full core suite green
(241 passed).
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