Skip to content

Simplify getenv FFI binding - #432

Open
shonfeder wants to merge 2 commits into
LPCIC:masterfrom
shonfeder:getenv-simpl
Open

Simplify getenv FFI binding#432
shonfeder wants to merge 2 commits into
LPCIC:masterfrom
shonfeder:getenv-simpl

Conversation

@shonfeder

@shonfeder shonfeder commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Sys.gentenv_opt was introduced in OCaml 4.05, and since the current compiler lower bound for elpi is 4.13, we know it will be available. Using it here allows us to forgo a try/with, and manual wrapping of the happy path in a Some.

This also lets us correct the documentation, which referred to Sys.getenv tho the implementation provided matches the behaviour of Sys.getenv_opt.

This is essentially just a stylistic fix I noticed while prepping for #427. I'll take offense if its not suitable for some reason, but any feedback in that case to guide the other work will be welcomed gratefully :)

`Sys.gentenv_opt` was introduced in OCaml 4.05, and since the current
compiler lower bound for elpi is 4.13, we know it will be available.
Using it here allows us to forgo a try/with, and manual wrapping of
the happy path in a `Some`.

This also lets us correct the documentation, which referred to
`Sys.getenv` tho the implementation provided matches the behaviour of
`Sys.getenv_opt`.
Looks like noisy, specious failures from having variable IDs in test
fixtures?
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