Skip to content

Facade presentation shortens by the representation's struct name only; a library prefix (sqlite3_ on sqlite3_stmt) is not recognized, so every statement operation needs rename #1610

Closed

Description

@ehartford

Found by the SQLite facade (D51 stage 12, ruling §66; lib/facades/sqlite3.w).

Ruling §54 / spec §16.2b.11: sqlite3_prepare_v2(db, …) "may be presented as db.prepare(…) when a recognizable naming/receiver pattern suggests it". The renderer's convention (compiler/FacadeRender.w facade_render_prefix_names / facade_render_shorten, from §16.2a) shortens by the struct name beneath the pointer: sqlite3 → sqlite3_, so sqlite3_open/sqlite3_errmsg/sqlite3_exec present as Database.open, db.errmsg(), db.exec(). For resource Statement wraps *mut sqlite3_stmt the prefix is sqlite3_stmt_, which no SQLite function carries: sqlite3_step(sqlite3_stmt *), sqlite3_column_text, sqlite3_finalize … get no sugar and are presented under their C names, so the facade spells rename step, rename column_text, … for every statement operation (nine of them).

The receiver pattern is recognizable: the first parameter is the representation, and the name carries the library prefix — the longest snake-case prefix of the struct name that is itself a prefix of the C name (sqlite3_ for sqlite3_stmt, curl_ for CURL/curl_easy_*, z_ for z_stream). Presentation is inferred silently (asymmetry rule: being wrong changes spellings, never safety), so this is a renderer convention change, not a facade-language change; ambiguity keeps failing closed (two operations shortening to one name keep their C names).

Until then the SQLite facade's rename lines are the explicit overrides §55 allows; the one §66 asks for (rename prepare) stays either way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions