Skip to content

'callback param N': a callback with no userdata; a retained one states its thread; the drafter writes it where the body only calls the pointer (#3178) - #3435

Merged
ehartford merged 4 commits into
mainfrom
bare-callback
Nov 18, 2026
Merged

ehartford merged 4 commits into
mainfrom
bare-callback

Conversation

@ehartford

@ehartford ehartford commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3178. Eric approved landing all of it, with the spec words, on 2026-11-18.

  • The clause. callback param N describes a callback with no userdata parameter: the argument is a function or a closure that captures nothing. A capturing closure is refused as before.
  • Retained callbacks state their thread. A bare callback the contract says is retained must state callback_thread any or callback_thread registering; without it the clause is an error with that fix-it.
  • A panic does not unwind into C. With has no unwinding: the panic aborts where it is raised (exit 134). A fixture pins it.
  • Drafter proof. The drafter writes the clause where the C body only calls the pointer or tests it for NULL (ci_param_only_called). Stored, passed on or copied to a local: raw, with a report line that names the clause. With a void * beside it the drafter writes nothing; the userdata pairing is stated, never drawn.
  • §9.1 rule 3. Coercing a With function to an extern "C" callback ends the single-thread proof for globals. That was applied only for a declared-only C function; a callback handed to a function the header defines (static inline) was not counted. Both count now.
  • Spec v7.61: the grammar line, the clause-table row and the §16.2b.9 sentence.

Tests: six behaviour and compile-error tests, one drafter test over six shapes. Battery green on the stack's top (2be269f); :release-checks green.

Eric Hartford added 4 commits November 18, 2026 11:52
@ehartford
ehartford added this pull request to stack #3438 November 18, 2026 20:37
@ehartford ehartford changed the title bare callback 'callback param N': a callback with no userdata; a retained one states its thread; the drafter writes it where the body only calls the pointer (#3178) Nov 18, 2026
@ehartford
ehartford marked this pull request as ready for review November 18, 2026 20:37
@ehartford
ehartford merged commit 34a97c5 into main Nov 18, 2026
@ehartford
ehartford deleted the bare-callback branch November 18, 2026 20:37
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.

Facade: 'parameter of a callback or array type' (68 functions, 9 libraries) stays raw

1 participant