Skip to content

feat(oxcaml): add parameters field for libraries - #12336

Merged
Alizter merged 1 commit into
ocaml:mainfrom
art-w:lib-field-parameters
Oct 6, 2025
Merged

Alizter merged 1 commit into
ocaml:mainfrom
art-w:lib-field-parameters

Conversation

@art-w

@art-w art-w commented Aug 29, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds a new (parameters ...) field to the library stanza, to define a parameterized library (see #11963). Parameterized libraries are currently only available with the OxCaml compiler, since they require a new compiler flag -parameter Name_of_parameter (for each specified parameter) to compile the modules of the parameterized library.

Fixes #12086

@art-w
art-w requested a review from Sudha247 August 29, 2025 12:50
@art-w
art-w force-pushed the lib-field-parameters branch 2 times, most recently from 3945c0e to b7624b9 Compare August 29, 2025 15:25
Comment thread src/dune_rules/module.ml Resolved
@art-w
art-w force-pushed the lib-field-parameters branch from b7624b9 to a0bc8e5 Compare September 4, 2025 07:10
@art-w
art-w requested a review from rgrinberg September 8, 2025 15:34
@art-w
art-w force-pushed the lib-field-parameters branch 2 times, most recently from 488cf39 to 258df6b Compare September 10, 2025 09:13

@rgrinberg rgrinberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Great work on getting on preserving the lazy loading everywhere.

Comment thread src/dune_rules/lib.ml Resolved
Comment thread src/dune_rules/lib.ml Resolved
@art-w
art-w force-pushed the lib-field-parameters branch 2 times, most recently from 1989c1d to 8fef3ae Compare September 18, 2025 13:58
@Alizter

Alizter commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator

This looks great! I've left a few questions but they are by no means blocking. I also have another: Is it feasible for library_parameters to also support parameters themselves?

@art-w

art-w commented Oct 3, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the review and the fun question! I just checked, the OxCaml compiler doesn't currently support parameterizing a library_parameter:

Error: Cannot combine -as-parameter with -parameter: parameters cannot
       be parameterised.

@Alizter

Alizter commented Oct 3, 2025

Copy link
Copy Markdown
Collaborator

If you rebase I can merge it once the CI is done.

@art-w
art-w force-pushed the lib-field-parameters branch from 8fef3ae to 7f7f7dc Compare October 6, 2025 09:14
@Alizter
Alizter merged commit 2127cae into ocaml:main Oct 6, 2025
@Alizter Alizter added this to the 3.21.0 milestone Jul 8, 2026
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.

[OxCaml] Parameterized libraries: parameterized library

3 participants