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

Document which Sys function raise Sys_error #6051

Closed
vicuna opened this issue Jun 24, 2013 · 4 comments
Closed

Document which Sys function raise Sys_error #6051

vicuna opened this issue Jun 24, 2013 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Jun 24, 2013

Original bug ID: 6051
Reporter: @dbuenzli
Status: closed (set by @damiendoligez on 2014-07-22T21:38:58Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 4.00.1
Target version: 4.02.0+dev
Fixed in version: 4.02.0+dev
Category: documentation
Tags: junior_job
Monitored by: @gasche

Bug description

There are quite a few functions in Sys that may raise Sys_error (e.g. Sys.remove). It would be nice to document that in the mli.

@vicuna
Copy link
Author

vicuna commented Jun 24, 2013

Comment author: @gasche

If someone out there is interested in contributing, this issue should be relatively easy to fix. Directly looking at stdlib/sys.ml won't tell you much, because most of the functions are implemented as external C stubs; one should look instead at the use of the C functions raising this exception (through "caml_sys_error", "caml_raise_sys_error" or "caml_sys_io_error"). The following regexp gives all call sites for any of these functions:

find . -name '.c' | xargs grep -e "caml\wsys\w*error" -A 10 -B 10 --color=always | less -R

It is then a matter of knowing where the C stubs using these functions are themselves called from the OCaml side, and annotating the .mli documentation accordingly -- as is already done for the functions in pervasives.mli.

@vicuna
Copy link
Author

vicuna commented Jun 25, 2013

Comment author: @xavierleroy

To a first approximation, all Sys functions can raise Sys_error or might raise it in the future. A blanket statement at the beginning of the Sys module might be better than a per-function description.

@vicuna
Copy link
Author

vicuna commented Jul 12, 2013

Comment author: @damiendoligez

I vote for the blanket statement.

@vicuna
Copy link
Author

vicuna commented Jul 22, 2014

Comment author: @damiendoligez

Documented in 4.02 (commit 15020).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant