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
Modeled C: no facade clause for a buffer with an element count (const int *values, int count); D64 pairs a buffer with a byte length only, so examples/c-interop tally_range/tally_total stay unsafe #1643
The pointer and the count are one []i32 on the With side, and the program already spells them that way (fn data(values: []i32) -> *const i32 + values.len() as i32) — inside unsafe, because no facade clause can state the pairing:
fn tally_range / lend is refused, correctly: a lend would make the call safe, but param 0: *const i32 values is a caller-owned buffer that needs a length contract, and no clause states one yet (#1621); a safe call over a raw pointer with no bounds is the partial model §16.2b.3 forbids — leave the call raw (§16.2b.5, §16.2b.8).
D64 (buffer param P len param L) renders []u8 and its length counts bytes; the decision says the T * + count form is deliberately not generalized "until it is decided whether the integer means bytes, elements, code units or structs".
What the example needs is the element form: a pairing that renders []i32 (or []T for the pointee) and supplies count = slice.len(); the wrong-pairing hazard D64 names (handing C a wrong length) is the same, so it is a stated clause, never inferred from int * + int. Until it lands, examples/c-interop/src/tally.w keeps three unsafe calls and with build :user-programs-safe counts them (the gate is already red on #1376's fixtures). src/facades/tally.w in the example names this gap beside each declaration.
Activity
Modeled C: explicit element buffers and callback composition (#1643)
spec: state explicit element-count facade buffers (D64, withlang-dev#…
Modeled C: explicit element buffers and callback composition (withlan…
Modeled C: explicit element buffers and callback composition (#1643) (#…