Repository navigation
[Blog post] Add Trying Incoherent Rust today with Context-Generic Programming - #5
Merged
Merged
Conversation
soareschen
force-pushed
the
incoherent-rust
branch
from
May 17, 2026 14:03
2d7c9b6 to
dc588b1
Compare
soareschen
force-pushed
the
incoherent-rust
branch
from
November 21, 2026 17:18
dc588b1 to
a5f4de9
Compare
soareschen
force-pushed
the
incoherent-rust
branch
from
November 25, 2026 21:00
a5f4de9 to
cadb80d
Compare
[claude-opus-5-5] The draft answered the March posts on dictionary passing and incoherent traits, and most of its CGP snippets no longer compiled. The post now opens on the discussion as it stands, corrects its claim that CGP resolves cyclic dependencies, quotes its sources exactly, and links the website's pages for the primer and related work, with a placeholder for a comparison page still to come. Its CGP code compiles in example-code, which gains cgp-serde, cgp-serde-json, cgp-error-anyhow, typed-arena, and hypershell as dev-dependencies for the arena and Hypershell examples.
[claude-opus-5-5] The post's illustrative blocks had typos and inconsistencies, such as call syntax in the TIR dictionary example and an argument missing from the scoped-impl example, and its prose carried hedges and repetition. The revision fixes those blocks, states that the context is the consumer trait's `Self`, drops an unverified claim about formalizing dictionary-passing style, links the `open` statement's reference and the modularity hierarchy, and gives the whole post a plain-language pass.
[claude-opus-5-5] The post turned Boxy's `const NAME` into a function, because `RealName` computes it with `core::any::type_name`, which is not const-stable, and readers could take that for a CGP limitation. The `Name` snippets now keep the constant and open with `#![feature(const_type_name)]`, and the post says the feature comes from the standard library. A new `example-code-nightly` crate, pinned to the nightly `cargo-cgp` uses, checks them with the struct-binding compile-fail fixture, a CI job runs it, and `AGENTS.md` sends such snippets there.
[claude-opus-5-5] The context-as-dictionary section lowered the CGP `Clone` example into a hand-written TIR listing that repeated what the prose already argued. The listing is gone, and the paragraphs after it state the lowering as a hypothetical in plain prose.
[claude-opus-5-5] Two sentences tied CGP's features to the releases that introduced them: implicit arguments to v0.7.0 and namespaces to v0.8.0. The version numbers date the post without helping the argument, so both sentences now name the features alone.
[claude-opus-5-5] The page cited Nadrieril's first post by its old title, called dictionary passing a design sketch, and said nothing of the types-team goal, the work on which cyclic impls are sound, or where CGP's context stops helping. It now names the goal and the cycles posts, and explains that a provider needing its own instance overflows with `E0275`, as the expression interpreter's dispatch layers show.
[claude-opus-5-5] Readers following the incoherent-Rust discussion had no page setting Cairo's named impls beside the other trait systems that allow several impls of one trait for one type; Rust's own proposals covered Cairo in one subsection. The new page compares Cairo, Scala's givens, OCaml's modular implicits, Haskell's overlapping instances, and Boxy's sketch on how each makes that choice, and shows CGP fixing it on the context, with its CGP code checked in `example-code`. The index, the coherence concept page, and Rust's own proposals now link it.
[claude-opus-5-5] The post's Related Work paragraph pointed at the comparison through a placeholder. The comparison now sits on the same branch, so the paragraph links it directly.
[claude-opus-5-5] The page referred to a Cairo serializer it never showed, called Haskell's global instances what most code wants, and claimed CGP has none of the soundness hazards of incoherent instances. It now ties the CGP example to Cairo's `ArrayDescribe`, states where global instances fit, and limits the coherence claim to what Rust's checks ensure: the compiler never picks between two candidates.
[claude-opus-5-5] Several passages added to Traits without coherence and Rust's own proposals joined claims with semicolons, stated a cause twice, or left a pronoun unclear. They now give each claim its own sentence and name what they refer to.
[claude-opus-5-5] The page compared Boxy's incoherent-Rust sketch beside Cairo, Scala, modular implicits, and Haskell, though Rust's own proposals already covers it, and the comparisons listed this page and Policy-based design near the top. The page now compares the four other systems, the post's sentence about it follows, and both pages sit at the end of the sidebar and the index's routing table.
[claude-opus-5-5] The page kept a short Cairo subsection and several Cairo examples after Traits without coherence took over that comparison, though Cairo is not one of Rust's own proposals. The section, the Cairo examples, and the Cairo source are gone, the remaining sentences on inference from scope link the other page, and Where to go next lists it.
[claude-opus-5-5] After the Cairo example left the vocabulary table, its higher-order-provider row named an impl passed at a call, which the row above already covers. The row now names a generic impl that takes another impl as a parameter, and the passage below it says how `#[use_provider]` writes that impl.
[claude-opus-5-5] The related-work paragraph named Haskell's overlapping and incoherent instances, but "Lessons for Rust" counted three answers and left Haskell out. The lessons now give Haskell's global answer with exceptions beside inference from scope, explicit naming, and the context, with the warning GHC's manual gives for its exceptions.
[claude-opus-5-5] The post alternated "context and capabilities" with the proposal's own "contexts and capabilities", and kept a cleft, two idioms, a delayed subject, and "dynamic-scoped". They now read directly, with the proposal named as its author titles it.
[claude-opus-5-5] The new sentence on Haskell's global answer said it keeps most code simple, which no source states, and its "its manual" could read as Haskell's. It now says a single global answer needs no wiring and names GHC's manual as the source of the warning.
[claude-opus-5-5] Some passages still held back their point behind filler such as "it is worth asking" and "This means that", stacked qualifiers, or long sentences that ran several claims together. They now state each point directly in the author's voice, with the code blocks and headings unchanged.
[claude-opus-5-5] The post answers posts from March but appears in November, with no word on why. A note after the excerpt now says it was drafted in April as a quick response, held for time and the v0.8.0 work, and only slightly revised.
[claude-opus-5-5] The *Prototype chains* leaf returned the literal "Bar", where every other type-level lookup on the page answers with `type_name` and its test compares against `type_name::<Bar>()`. The leaf now returns `type_name::<Self>()`, and the comparison page's baseline bound names `HasStaticStringFor<FooKey>` instead of the removed `Describe`.
[claude-opus-5-5] The Dynamic dispatch comparison ran the keyed lookup of Type-level tables through a tag, function-pointer tables, dictionary chains, passed dictionaries, and multiple dispatch, and compared how each chooses types. It now follows one greeting: JavaScript and Python lookup with a one-level prototype, Java, Rust dyn, and Go method tables, and CGP's providers with implicit fields, the table on each context, the checks that reject the wrong greeter and the missing entry, and an aggregate provider as the prototype. The mirror and the two fixtures follow, and Namespaces drops its link to the page, which no longer covers namespaces.
[claude-opus-5-5] The Java paragraph joined the JVM's method selection with the example's lead-in, and the prototype comparison ran past the line width. The lead-in is its own paragraph, and the line is rewrapped.
[claude-opus-5-5] The page named vtables in Go, left the JavaScript example's TypeError line unexplained, omitted Go beside the consumer trait's interface, and named the dyn-compatibility rules and the Type-level tables cycle without linking them. It now says Go's interfaces, explains the missing method, links both, and splits and rewraps two long passages.
[claude-opus-5-5] The page described C++ virtual methods and multiple dispatch in prose, beside examples that show neither. Both paragraphs go, with their family-table entries and their sources.
[claude-opus-5-5] The costs listed missing methods but not the JavaScript example's silent `undefined` for a missing field, the family table called the first family "Dictionary" under a heading on name lookup, and the first use of "component" lacked its glossary link. The costs now name the silent field, the row reads "Name lookup", and the term links the glossary.
[claude-opus-5-5] A natural-writing pass found the CGP section still opening on "every family" after the page kept two, two tables without a lead-in, and several sentences joining separate claims with a semicolon or "and". The opening now counts both families with CGP's wiring, each table has a lead-in, and those sentences are split or reworded.
[claude-opus-5-5] A second natural-writing pass found sentences still joining separate claims with "where", a semicolon, or "and", an ambiguous "The lookup", and a trait-object sentence that read as a non sequitur after the survey. Those sentences are split or reworded, and the foreign-types passage now leads with what runtime field access reaches before CGP's limit.
[claude-opus-5-5] The incoherent-Rust post's primer stated the first level of bypassing coherence in prose only, so the section went from a summary straight to the parameter-targeted `Serialize<T>`. The primer now shows that level in code: serde's `Serialize` redefined as a component, a `Display`-based provider, and `Person` wiring it. The `Serialize<T>` version then reads as the same trait with the value moved out of `Self`. The example-code mirror compiles both levels.
[claude-opus-5-5] The section's closing paragraphs packed the value-level dictionary, the instantiation order, a runtime-dictionary aside on dynamic scoping, and the full account of the `E0275` cycle and its workaround into three dense paragraphs, and moved between them without transitions. They now conclude that CGP code could be desugared naturally into dictionary-passing style, such as PolyMiniRust, with the context as the root dictionary, and treat cycles as the one exception, leaving the workaround's detail to the Rust's own proposals comparison.
[claude-opus-5-5] The zero-arity section compressed Capabilities using Plain Traits into one paragraph of quotations, and it did not say how his capabilities work, so the contrast with an incoherent selfless trait was hard to follow. The section now explains, in its own words, capabilities as bounds on a zero-sized `Env` type, selfless traits as a way to drop that type, and the difference that matters here: his capability traits carry no methods and hold by the target or a runtime check, while an incoherent selfless trait carries methods whose implementation the context chooses.
[claude-opus-5-5] The post linked each source and site page mostly at its first mention, so a reader several screens later met Boxy's incoherent traits, Nadrieril's dictionaries, scoped impls, or a CGP construct with no link in view. Each such mention now links its source, to the section that holds the example where one exists, and the outline and summary link the sections they name.
[claude-opus-5-5] Phrases such as "the sections below", "the later examples", "from earlier", and later mentions of named impls, zero-arity traits, and scoped impls pointed at sections several screens away without a link. Each now links the section it names.
[claude-opus-5-5] The post used its own term, zero-arity traits, beside Nadrieril's selfless traits for the same shape, so readers met two names for one idea. It now uses selfless traits throughout, with the section, its links, and its example-code module renamed to match.
[claude-opus-5-5] A full natural-writing pass over the post found pronouns without a clear referent, a background sentence carrying two claims, a colon that pointed past the clause it explained, a run of passive sentences after the `with` example, and a few awkward phrasings. Each is revised without changing a claim or a link.
[claude-opus-5-5] The conclusion's last plans said CGP would simply keep its library encoding if Incoherent Rust left out its features, and proposed desugaring CGP into explicit proofs once nightly let programs write them. It now offers to work with the compiler team where there is an opportunity, states the risk to CGP if the features are left out, and places the explicit-proof experiment in an experimental fork of Rust that implements CGP's features in the compiler and desugars them into the dictionary-passing intermediate representation.
[claude-opus-5-5] The post placed contexts and capabilities, a desugared feature, inside the section on the context as a dictionary, and placed selfless traits there too, though they are one of CGP's ideas for Incoherent Rust and the abstract types built on them sat in that later section. Contexts and capabilities now closes the desugaring section, selfless traits now precede abstract types among the ideas, and the cycle discussion has its own subsection that the earlier links point to. The revised `Serialize<T>` in the incoherent-traits section carries a comment saying it follows Boxy's simpler signature, and the example-code modules follow the new heading order. The front matter gains the `incoherent-rust-today` slug, the `deepdive` tag, and a written description.
[claude-opus-5-5] After the reorganization, the desugaring section's introduction named only Boxy's and Nadrieril's features though the section now ends with Tyler Mandry's contexts and capabilities, the dictionary example's "earlier ideas" no longer named which ones, and the Scala comparison's "this kind of code" sat several paragraphs from the code it meant. Each now names its subject, and the `touch` example's three-claim sentence is split.
[claude-opus-5-5] The post lacked the footnote that says how it was made. It now ends with a line saying the author drafted it and an AI agent revised it and checked its code and claims, linking the AI disclosure's section on blog posts.
[claude-opus-5-5] The docs pages' provenance footers opened with "An AI agent wrote this page", and several joined a second claim with ", and". Each footer now reads "This page was written by an AI agent from the CGP knowledge base", with each verification claim in its own sentence, matching the blog post's line. The Contribute page drops its footer.
[claude-opus-5-5] The AI disclosure page ended with a section saying which pages carry a provenance note and that the front page was the one exception. The section is gone, so the page ends with its section on responsibility.
[claude-opus-5-5] The comparisons index row and the Dynamic dispatch opening still named C++ and multiple dispatch, which the page no longer covers. The row now names Rust `dyn Trait` in their place, and the opening names vtables in Java alone.
[claude-opus-5-5] The Dynamic dispatch comparison was titled "Dynamic dispatch, dynamic typing, and prototypal inheritance", and the incoherent-Rust post carried the date of its first revision. The page is now titled "Dynamic dispatch", and the post's file carries its publication date, with the snippet crates' references following.
[claude-opus-5-5] The Concepts pages that the incoherent-Rust post builds on did not point to it. Each now lists the post in its Where to go next section, linked to the section that develops the page's idea.
[claude-opus-5-5] The Concepts and comparison pages that the post builds on mentioned it at most in a routing list. Each now cites the post's matching section in the paragraph its argument develops, and Rust's own proposals and Traits without coherence also route to it.
[claude-opus-5-5] Eight Concepts and comparison pages cited the post although their subject is not coherence. Those pages return to their earlier text, and only Bypassing coherence, Modularity hierarchy, Rust's own proposals, and Traits without coherence cite it.
[claude-opus-5-5] Rewriting the docs footers left each changed page without a final newline. Every such page ends with one again, the post's struct-binding fixture names the heading the post now uses, and the coherence page's routing item for the post says what CGP expresses.
[claude-opus-5-5] The citations of the post on four pages opened on the post rather than the topic, joined claims with a trailing "which", or left unclear what they translated. They now pick up the paragraph's topic and name what the post shows.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
[claude-opus-5-5] In March, Nadrieril's posts on explicit trait proofs and Boxy's An Incoherent Rust started a discussion about traits that opt out of coherence. The discussion has since become the types team's Dictionary Passing Style Experiment. CGP already expresses part of that design space on stable Rust, but the site lacked writing that set CGP against it. This PR adds a deep-dive post for language-design readers, with the documentation pages it links, so those readers can see which parts of Incoherent Rust CGP lets them try today and where it falls short:
example-code, and the snippets that need the unstableconst_type_namefeature compile in a newexample-code-nightlycrate.IsProviderFormarker that Consumer and provider traits now names. Bypassing coherence, Aggregate providers, Type-level DSLs, the Concepts index, and the wiring and namespace reference pages link the new page. Bypassing coherence and Modularity hierarchy, the two Concepts pages that discuss coherence directly, also cite the post where it develops their argument.The documentation pages' provenance footers made the agent their subject, as in "An AI agent wrote this page", and several joined a verification claim to that sentence with ", and". Each footer now makes the page its subject, as the post's own line does, and gives each verification claim its own sentence: "This page was written by an AI agent from the CGP knowledge base." Contribute no longer has a footer, and the AI disclosure page no longer has its How pages are marked section.
Impact
example-code-nightlypins its nightly inrust-toolchain.toml, andtest-deploy.yamlgains a Nightly snippet tests job that runs it.AGENTS.mdsays when a snippet belongs in that crate.Areas needing attention