atdml: Add support for <ocaml field_prefix> + no prefix on function labels#455
Merged
atdml: Add support for <ocaml field_prefix> + no prefix on function labels#455
Conversation
Prefixes are applied to generated OCaml record field names but not to labeled arguments in create_ functions, matching the task description from issue #433 (last comment). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…check Introduce make_prefixed_trs which builds two separate name translators: - label_tr: keyword-checks the raw field name (no prefix) for labeled args - pftr: concatenates the prefix with the raw name *then* keyword-checks, so "mod"^"ule" = "module" (keyword) → "module_", while the label is "ule"; and "mod"^"if" = "modif" (not a keyword) → "modif", while the label is "if_". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test 'type t = { ule: int; if: int; if_: int } <ocaml field_prefix="mod">'.
Shows that "if_" (ATD) gets label ~if__ because ~if_ was already claimed
by the rename of the keyword field "if".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename all make_ → create_ (make_foo → create_foo, val make → val create) - Add "Primitive type aliases" subsection: documents private type in .mli, create_* constructor, :> coercion, zero runtime overhead - Extend "Reserved name handling" to mention record fields and variants - Add "Field field_prefix" entry under Section ocaml: documents the annotation, the unprefixed-label / prefixed-field split, and the keyword-escaping semantics with the mod+ule/mod+if worked example Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Closes #433
PR checklist
CHANGES.mdis up-to-date