Skip to content

Check for parameterised libraries from the compiler config#12393

Merged
rgrinberg merged 1 commit intoocaml:mainfrom
Sudha247:parameterised_modules
Sep 5, 2025
Merged

Check for parameterised libraries from the compiler config#12393
rgrinberg merged 1 commit intoocaml:mainfrom
Sudha247:parameterised_modules

Conversation

@Sudha247
Copy link
Copy Markdown
Collaborator

@Sudha247 Sudha247 commented Sep 4, 2025

Changes the check for parameterised libraries to the flag emitted by the OxCaml compiler, rather than relying on parsing the compiler version string. This way, we rely on the implementation and not the compiler version, as this feature could get upstreamed to ocaml/ocaml. The OxCaml compiler config (ocamlc -config) emits parameterised_modules: true, which is being checked to detect whether parameterised libraries are available.

@Sudha247 Sudha247 requested a review from art-w September 4, 2025 10:47
@Sudha247 Sudha247 added the oxcaml Related to the support to OxCaml functionnalities label Sep 4, 2025
@Sudha247 Sudha247 force-pushed the parameterised_modules branch from 272e435 to bc5330b Compare September 4, 2025 10:51
@Alizter
Copy link
Copy Markdown
Collaborator

Alizter commented Sep 4, 2025

@Sudha247
Copy link
Copy Markdown
Collaborator Author

Sudha247 commented Sep 4, 2025

I think this isn't directly related to #12236, this PR checks for a specific feature while the latter checks for a compiler branch.

Copy link
Copy Markdown
Collaborator

@art-w art-w left a comment

Choose a reason for hiding this comment

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

Looks good! We are hoping that the parameterized feature gets upstream to OCaml one day, so this check is more future proof instead of relying on detecting the OxCaml compiler :)

@Alizter
Copy link
Copy Markdown
Collaborator

Alizter commented Sep 4, 2025

When OxCaml features are upstreamed, are the config names ever changed? That would be my only worry with this.

|| Stdune.String.is_suffix ~suffix:ox version
;;

let supports_parametrized_library version =
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.

Why did you change the spelling of parametrized?

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.

I guess this is the spelling they have upstream in oxcaml? In that case, this is the spelling we should use.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, parameterised_modules is the spelling in OxCaml.

Copy link
Copy Markdown
Member

@shonfeder shonfeder left a comment

Choose a reason for hiding this comment

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

LGTM! Seems like a nice clean improvement.

IIUC, there are no objections to this PR and it can be merged as soon as the merge conflicts are resolved.

Signed-off-by: Sudha Parimala <sudharg247@gmail.com>
@Sudha247 Sudha247 force-pushed the parameterised_modules branch from bc5330b to 12434bb Compare September 5, 2025 08:10
@rgrinberg rgrinberg merged commit 9128831 into ocaml:main Sep 5, 2025
26 checks passed
davesnx added a commit to davesnx/dune that referenced this pull request Sep 5, 2025
* 'main' of github.com:/ocaml/dune: (946 commits)
  refactor(boot): some helpers for command line flags (ocaml#12375)
  refactor(boot): move file exists check to one place (ocaml#12395)
  Check for parameterised libraries from the compiler config (ocaml#12393)
  Update test/blackbox-tests/test-cases/ocaml-config-ox.t
  Update test/blackbox-tests/test-cases/oxcaml/ocaml-config-ox-true.t
  Add changes
  Turn the %{ocaml-config:ox} test into one file, and add a +ve test case
  Clarify variable vars in ocaml_config.ml
  Expose the ocamlc -config parameter "ox"
  doc: changing heading levels for sub-sections (ocaml#12389)
  chore(deps): bump actions/checkout from 4 to 5 (ocaml#12380)
  refactor(boot): remove pointless [assert false] (ocaml#12378)
  refactor(boot): mangling simplification (ocaml#12377)
  refactor(boot): move ocaml-config bindings (ocaml#12376)
  refactor(boot): simplify blake3 flag handling (ocaml#12379)
  refactor(boot): use [Module_name.t] in ocamldep parsing (ocaml#12373)
  refactor(boot): replace concat + filter_map with concat_map (ocaml#12374)
  chore: move tests to dune-init
  move test to virtual-libraries
  chore: move test to directory-targets
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oxcaml Related to the support to OxCaml functionnalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants