Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API triggers unerasable-optional-argument warning in OCaml 4.12.0 #3

Open
jmid opened this issue Sep 24, 2021 · 0 comments
Open

API triggers unerasable-optional-argument warning in OCaml 4.12.0 #3

jmid opened this issue Sep 24, 2021 · 0 comments

Comments

@jmid
Copy link
Owner

jmid commented Sep 24, 2021

@tmcgilchrist reported how the API triggers unerasable-optional-argument errors/warnings in OCaml 4.12.0
here #2 (comment)

File "src/qCSTM.ml", line 94, characters 25-35:
15
94 |   let consistency_test ?(count=1000) ~name =
16
                              ^^^^^^^^^^
17
Error (warning 16 [unerasable-optional-argument]): this optional argument cannot be erased.
18
File "src/qCSTM.ml", line 120, characters 19-29:
19
120 |   let agree_test ?(count=1000) ~name =
20
                         ^^^^^^^^^^
21
Error (warning 16 [unerasable-optional-argument]): this optional argument cannot be erased.

One potential fix is to swap both count and name to both be labelled arguments (#2 (review)):

Edit: as for the unerasable-optional-argument and OCaml 4.12, I think the API should just make count labelled like name, but that change is probably also best handled separately...

@tmcgilchrist suggests another option of letting the functions take a unit as the last parameter (#2 (comment)):

@jmid one option for fixing 4.12 is adding unit to the functions see
tmcgilchrist/qcstm@fb226ad

I haven't used this enough to tell whether making ~count a label, requiring the user to supply a value, vs appending () is more ergonomic.

I suppose a third option is to disable the error/warning (-w -16?)... 😅

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

No branches or pull requests

1 participant