You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Facade presentation: trailing raw arguments the C contract makes optional (prepare(sql, -1, null), exec(…, null)) stay on the presented method — ceremony the facade should remove #1624
Found by the ruling §66 example rewrite (build/release_uat_fixtures/sqlite3_main.w, docs/with_for_ai.md). What the application writes today:
let Ok(stmt) = db.prepare("SELECT value FROM t", -1, null) else: …
db.exec("CREATE TABLE …", None, null) // #1618 for the callback
sqlite3_prepare_v2(db, zSql, nByte, ppStmt, pzTail): the presented prepare takes nByte (-1 = "read up to the first NUL" — the facade already passes a NUL-terminated &str, so the compiler knows the length) and pzTail: *mut *mut i8 ("If pzTail is not NULL then *pzTail is made to point to the first byte past the end of the first SQL statement") — a raw out slot the program declines with null.
sqlite3_exec(…, char **errmsg): "If errmsg is not NULL then any error message is written into memory obtained from sqlite3_malloc()" — the same raw out slot, declined with null.
Both are spellings the compiler already knows (the length of the text it marshals; that the program did not ask for the tail/errmsg), so per the mission they are ceremony. Proposal: an fn-item clause for a declinable raw out slot (e.g. optional param 4 → omitted from the presented method, NULL passed; a program wanting the tail spells the raw call), and nByte-style length parameters derived from the marshalled text (length param 2 of param 1). Related: #1500 (the raw out slot exposed on the lend rendering), #1618 (nullable callback).
Ruled (Eric 2026-09-24; §16.2b.11 "Fixed arguments" / D64): param N fixed <literal> binds a C parameter to a literal and removes it from the presented signature; the raw operation stays available. Not default — it is not an optional argument. Implementation in the next modeled-C batch.
Another instance from examples/c-interop (PR #1640): sqlite3_bind_text(stmt, i, text, -1, SQLITE_TRANSIENT). With fn sqlite3_bind_text / lend in the project's facade the method renders as stmt.bind_text(1, "abc", -1, <destructor>), but the sentinel cannot be passed: SQLITE_TRANSIENT ((sqlite3_destructor_type)-1, imported as a global of type extern "C" fn(*mut c_void) -> Unit) is refused with wrong argument type in call to 'Statement.bind_text' … parameter 'p4' expects extern "C" fn(*mut c_void) -> Unit / actual type: extern "C" fn(*mut c_void) -> Unit (the same types, so this is the #1609 coercion class on the rendered method), and let transient: extern "C" fn(*mut c_void) -> Unit = SQLITE_TRANSIENT is type mismatch in binding. Only a typed local of a real fn compiles — which would be the wrong contract (SQLITE_STATIC/a no-op destructor keeps the borrowed str pointer past the call).
The honest facade spelling is D64's param 4 fixed SQLITE_TRANSIENT — the only safe value under a lend of the text — and it is not implemented on the modeled-c stack yet (unknown facade clause 'param'). Until it lands the example binds an integer and its README says why.
Activity
spec §16.2b.8 / §16.2b.11 / D64: facade buffer pairing (buffer param …
ehartford commentedon Sep 24, 2026
Ruled (Eric 2026-09-24; §16.2b.11 "Fixed arguments" / D64):
param N fixed <literal>binds a C parameter to a literal and removes it from the presented signature; the raw operation stays available. Notdefault— it is not an optional argument. Implementation in the next modeled-C batch.Release UAT: sqlite3_main.w on the SQLite facade surface, 11 unsafe -…
Release UAT: sqlite3_main.w on the SQLite facade surface, 11 unsafe -…
examples/c-interop: on the facade surface — sqlite3 through lib/facad…
ehartford commentedon Sep 24, 2026
Another instance from
examples/c-interop(PR #1640):sqlite3_bind_text(stmt, i, text, -1, SQLITE_TRANSIENT). Withfn sqlite3_bind_text / lendin the project's facade the method renders asstmt.bind_text(1, "abc", -1, <destructor>), but the sentinel cannot be passed:SQLITE_TRANSIENT((sqlite3_destructor_type)-1, imported as a global of typeextern "C" fn(*mut c_void) -> Unit) is refused withwrong argument type in call to 'Statement.bind_text' … parameter 'p4' expects extern "C" fn(*mut c_void) -> Unit / actual type: extern "C" fn(*mut c_void) -> Unit(the same types, so this is the #1609 coercion class on the rendered method), andlet transient: extern "C" fn(*mut c_void) -> Unit = SQLITE_TRANSIENTistype mismatch in binding. Only a typed local of a real fn compiles — which would be the wrong contract (SQLITE_STATIC/a no-op destructor keeps the borrowedstrpointer past the call).The honest facade spelling is D64's
param 4 fixed SQLITE_TRANSIENT— the only safe value under a lend of the text — and it is not implemented on the modeled-c stack yet (unknown facade clause 'param'). Until it lands the example binds an integer and its README says why.examples/c-interop: on the facade surface — sqlite3 through lib/facad…
Release UAT: sqlite3_main.w on the SQLite facade surface, 11 unsafe -…
Facade D64: buffer pairing (`buffer param P len|capacity param L [ino…
examples/c-interop: on the facade surface — sqlite3 through lib/facad…
Release UAT: sqlite3_main.w on the SQLite facade surface, 11 unsafe -…
Facade D64: buffer pairing (`buffer param P len|capacity param L [ino…
examples/c-interop: on the facade surface — sqlite3 through lib/facad…
examples/c-interop: on the facade surface — sqlite3 through lib/facad…
examples/c-interop: on the facade surface — sqlite3 through lib/facad…
Modeled C §66: UAT and examples rewritten to the facade surface; zlib…
Modeled C D64: buffer pairing and fixed arguments; zlib and bzip2 fac…
examples/c-interop: on the facade surface — sqlite3 through lib/facad…
examples/c-interop: the rewritten example, recovered from an unpushed…