Skip to content

Commit 00a59ff

Browse files
committed
kit: state the surface claim as it was measured, not as it was reasoned
The claim is that the kit cannot be mistaken for an implementation because it exports no name beginning with kal_, and the claim holds: measured on its objects, zero of the defined names do. ⚠️ The REASON given was wrong in its particulars. It said a C++ name is mangled to `_ZN3kal3kit…`, and these objects contain no such symbol: the operations are inline and are emitted into consumers rather than exported, so what the objects define are module initialisers like `_ZGIW7openkalW3kitW7channel`. An argument that rests on how a compiler mangles names is worth checking against what the compiler emitted. The structural conclusion is unchanged --- C++ mangling cannot produce a bare kal_ symbol --- but a reader following the comment to verify it would have looked for something that is not there.
1 parent 8f7f9f9 commit 00a59ff

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ written once.
167167
**The contract form is what makes the two unmistakable.** Clause 10 states that
168168
openkal's contract is a C application binary interface. The kit deliberately is
169169
not one: it is C++ modules in `namespace kal::kit`, and it exports no name
170-
beginning with `kal_`. A C++ name is mangled to `_ZN3kal3kit…`, so
170+
beginning with `kal_`. Measured on its objects: the defined names are C++ mangled
171+
module initialisers such as `_ZGIW7openkalW3kitW7channel`, and the operations are
172+
inline and emitted into consumers rather than exported at all. So
171173
`tools/check-surface.sh --complete` does not read a program that links the kit as
172174
an implementation which has added names — the rule that checker enforces is about
173175
the C surface, and the kit has none.

kit/mcpp.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,19 @@ repo = "https://github.com/mcpplibs/openkal"
2525
#
2626
# Clause 10 states that openkal's contract is a C application binary interface.
2727
# This package deliberately is not one: it is C++ modules in `namespace kal::kit`
28-
# and it exports no name beginning with `kal_`. A C++ name is mangled to
29-
# `_ZN3kal3kit…`, so `tools/check-surface.sh --complete` does not read this
30-
# package as an implementation that has added names --- the rule it enforces is
28+
# and it exports no name beginning with `kal_`. Measured on its objects --- the
29+
# defined names are C++ mangled module initialisers such as
30+
# `_ZGIW7openkalW3kitW7channel`, and the operations themselves are inline and
31+
# emitted into consumers rather than exported at all. So
32+
# `tools/check-surface.sh --complete` does not read a program linking this
33+
# package as an implementation that has added names: the rule it enforces is
3134
# about the C surface, and this package has none.
3235
#
36+
# ⚠️ THE MEASUREMENT MATTERS BECAUSE THE ARGUMENT IS STRUCTURAL. A claim that
37+
# rests on how a compiler mangles names is worth checking against what the
38+
# compiler actually emitted, and the first form of this comment named a mangling
39+
# (`_ZN3kal3kit…`) these objects do not contain.
40+
#
3341
# So "is this normative" is answered by the shape of what is exported rather
3442
# than by a sentence saying it is not. A sentence can be overlooked; a mangled
3543
# name cannot become a C symbol.

0 commit comments

Comments
 (0)