Skip to content

Facade grammar: a destroyer whose resource is not its first parameter (20 functions, 6 libraries: BZ2_bzReadClose(int*, BZFILE*)) #3177

Closed

Description

@ehartford

Part of #3115; cluster from the #3116 survey: 'destroyer whose resource is not its first parameter (§16.2b.13)', 20 functions in 6 libraries (bzip2 BZ2_bzReadClose/BZ2_bzWriteClose, libxml2 xmlSwitchInputEncoding, …), plus 5 destroyers with an undescribed parameter (an allocator pointer, a callback: xz_utils lzma_index_hash_end, libxml2 xmlHashFree). The facade's drop names a function and assumes param 0; it needs the parameter index and the other parameters' values (an out-pointer for the error, NULL for the allocator).

Activity

  1. added
    bug
    on Nov 9, 2026
  2. ehartford commented on Nov 18, 2026

    @ehartford
    ContributorAuthor

    Needs Eric: this is grammar, and §31 words are his.

    Facts. §31's destruction = "drop" c_name | "destroys" c_name | "abandon" c_name names a function and takes its first parameter as the resource (drop f: "taking only the representation"; destroys f: an operation with further arguments). BZ2_bzReadClose(int *bzerror, BZFILE *b) puts the resource second, so no line can state it and the function stays raw (20 functions in 6 libraries by the #3116 survey).

    The spelling already in the grammar for the same problem on the producing side: from f(out param N) and init f(self), and the profile rule pattern [ "(" ( "out" param_ref | "self" ) ")" ].

    Proposal for a ruling: destroys f(param N) (and drop f(param N) where the other parameters are fixed by param M fixed … lines on fn f): the parenthesized parameter is the one that receives the resource; without it, the first, as today. One new production, mirroring from f(out param N); a wrong N is checked against the parameter's type as the first parameter is today. Prediction: yes, 75%.

    Not implemented: the clause is a grant (it says which pointer is destroyed), so its words come first.

  3. ehartford commented on Nov 20, 2026

    @ehartford
    ContributorAuthor

    Labelled human attn needed (2026-11-20): the proposal above (destroys f(param N) / drop f(param N), one production mirroring from f(out param N)) is new contract grammar that grants which pointer is destroyed, so its words are Eric's. Nothing else blocks it; implementation follows the ruling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions