diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-25 21:18:06 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-10-02 21:38:14 -0400 |
| commit | e1994c4e01788fe46f534dddb104a1c808f47f48 (patch) | |
| tree | 25a481a48c662d9e7abd0074771d650422a17359 /dlang/README.md | |
| parent | ocda-dump, and the four disagreements it found (diff) | |
ocda-lib in Gleam, and four agreements of 36 of 36
The model, both loaders, the dispatch and the canonical dump, in Gleam.
A deliberate field-for-field mirror of the D library, including where
that is not the most idiomatic Gleam: text is one string with the lines
joined by newline rather than a list of lines, and the properties are
typed fields rather than a list of pairs. A difference that existed in
one language and not the other would show in every dump and mean
nothing, so the two lose the same distinctions in the same places.
The dump is what makes the agreement testable. Both languages write it
byte for byte alike, so four questions are diff, and over the reference
collection all four hold:
D: .ssp == .ocda.db 36 of 36
Gleam: .ssp == .ocda.db 36 of 36
.ssp: D == Gleam 36 of 36
.ocda.db: D == Gleam 36 of 36
and a fifth, that the two report exactly the same ignored properties
with the same counts.
The Gleam .ssp loader agreed with the D one at the first attempt. The
Gleam .ocda.db loader had one defect of its own, found by the sweep and
worth recording because of its shape: a JSON element decoder handled
strings and integers and fell through to a fallback that yielded "".
table_widths is an integer array except where the columns divide
evenly, when it is [33.3333,...], and one table in the collection does
that. Its widths came back as three empty strings, so a value that
could not be read turned into one that looked read. That is the failure
the unknown counts exist to prevent, and a decoder fallback quietly
reintroduces it.
Shipped as an Erlang shipment rather than an escript, as the .ocda.db
reader is and for the same reason: sqlite on the BEAM is a NIF and a
NIF cannot load from inside an escript archive.
gleam.toml and the model came in with the previous commit, which was
about the dump; they belong here.
(assisted by Claude-Code)
Diffstat (limited to 'dlang/README.md')
| -rw-r--r-- | dlang/README.md | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/dlang/README.md b/dlang/README.md index 711c770..262162f 100644 --- a/dlang/README.md +++ b/dlang/README.md @@ -10,6 +10,7 @@ The abstraction's model and both its loaders, as a dub library. | `ocda.load_ssp` | text -> model | | `ocda.load_db` | sqlite -> model | | `ocda.load` | what a path is, and loading it | +| `ocda.dump` | the model written out canonically, as an oracle | | `ocda.sqlite` | the sqlite3 C API, declared rather than depended upon | `ocda.model` importing nothing is the property that matters: a writer @@ -30,20 +31,32 @@ foreach (obj; doc.body) { ... } Link `sqlite3`; the library declares the dozen functions it needs rather than taking a binding from the registry, so there is nothing to fetch. -## The agreement check +## The two checks ```sh -nix build -./result/bin/ocda-agree <doc>.ssp <doc>.ocda.db [lang] +nix build .#ocda-agree && ./result/bin/ocda-agree <doc>.ssp <doc>.ocda.db [lang] +nix build .#ocda-dump && ./result/bin/ocda-dump [--unknown] <file> [lang] ``` -`test/agree.d` is the whole of it: load both, compare the models. It is the -library's reason to exist, put to the question. +`agree` loads both and compares ten fields of each object, naming the field +where they part company. `agree` found the blank-first-text-line defect and +was not enough for anything subtler. + +**`ocda-dump` is the stronger check**: the whole loaded model, every field, +written out in a form fully determined by the model, so that two +implementations can be compared with `diff`. It is an oracle, not an output +format; anything reading it to reconstruct a document has misunderstood it. +It agrees byte for byte with the Gleam library's `ocda-lib dump`, which is +the point of having it. + +It found four disagreements `agree` could not see. They are in the +repository README and in the history. ## Build ```sh -nix build # the agreement check +nix build .#ocda-agree # the agreement check +nix build .#ocda-dump # the canonical dump nix develop # ldc, dub, dtools, sqlite dub build # the library ``` |
