Skip to content

docs(v13): model class inheritance with phantom types - #1466

Closed
fhammerschmidt wants to merge 2 commits into
rescript-lang:v13from
fhammerschmidt:docs/v13-phantom-class-inheritance
Closed

fhammerschmidt wants to merge 2 commits into
rescript-lang:v13from
fhammerschmidt:docs/v13-phantom-class-inheritance

Conversation

@fhammerschmidt

@fhammerschmidt fhammerschmidt commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Port #1465 to v13. The inheritance example now uses phantom type parameters constrained by polymorphic variants, allowing dog->Animal.getName directly while rejecting parent values passed to Dog.bark.

Keep the existing JavaScript Animal → Mammal → Dog implementation and @send method bindings. Update the .resi example and the cross-link under Type Parameter, and link the polymorphic variant page's lower-bound section to the inheritance example. All three changed pages are identical to the v12 update.

Validation: the inheritance and type pages pass example compilation and output checks on this branch. All changed pages pass formatting and the full relative-link check. MDX compilation and a runtime fixture using the exact documented bindings and JavaScript passed for the identical v12 content, including rejection checks for invalid subclass calls and missing parent tags.

Follow-up to #1463.

Replace private aliases and explicit coercions with phantom type parameters constrained by polymorphic variants. Keep the Animal, Mammal, and Dog JavaScript hierarchy and method bindings, allowing Dog values to call parent methods directly.

Update the interface example and move the cross-link to the type parameter section.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T18:59:13.971480Z 8dd3b77 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Point readers of polymorphic variant lower bounds to the practical inheritance binding example that combines them with phantom type parameters.
@fhammerschmidt
fhammerschmidt deleted the docs/v13-phantom-class-inheritance branch October 22, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant