Skip to content

Improve cppo usage - #105

Open
fantazio wants to merge 2 commits into
LexiFi:masterfrom
fantazio:cppo
Open

Improve cppo usage#105
fantazio wants to merge 2 commits into
LexiFi:masterfrom
fantazio:cppo

Conversation

@fantazio

Copy link
Copy Markdown
Collaborator

Gather most of the uses in Utils.Compat, in dedicated functions (either conversions or getters).
Sort the branches in version descending order.
Iff the conditional branches are close enough, do not repeat the bounds, and iff the #else is close enough the the previous condition, do not convert it into #elif.
If all the versions are accounted without #else, add an #else that throws an #error.

Gather most of the uses in Utils.Compat, in dedicated functions (either
conversions or getters).
Sort the branches in version descending order.
If the conditional branches are close enough, do not repeat the bounds.
If the #else stands out enough, do not convert it into #elif.
If all the versions should be accounted without #else, add an #else that
throws an #error.
Instead of systematically returning an option, they now return a result,
and a dedicated error gadt `'a invalid_arg` is introduced.
In addition, getters have a `*_exn` variant to directly unwrap the
result when the argument is already known to have the right shape.
@fantazio fantazio mentioned this pull request Sep 11, 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.

1 participant