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

Expose unsafe_get and unsafe_set from Array and Bytes modules #7536

Closed
vicuna opened this issue May 20, 2017 · 2 comments
Closed

Expose unsafe_get and unsafe_set from Array and Bytes modules #7536

vicuna opened this issue May 20, 2017 · 2 comments

Comments

@vicuna
Copy link

vicuna commented May 20, 2017

Original bug ID: 7536
Reporter: Eugene
Assigned to: @gasche
Status: resolved (set by @gasche on 2017-05-20T15:16:03Z)
Resolution: not a bug
Priority: normal
Severity: feature
Version: 4.04.1
Category: standard library

Bug description

Both ocamlc and ocamlopt have -unsafe flag, but sometimes it's more convenient to mix safe and unsafe versions.
Unfortunately, Array module doesn't expose this functions (and Bytes functions, while exposed, isn't documented).
There is one workaround, however (used by Core_kernel, for example) - declare this functions as external. But it is also not very convenient.

@vicuna
Copy link
Author

vicuna commented May 20, 2017

Comment author: @dra27

I don't follow what it is you'd like changed:

        OCaml version 4.05.0+dev8-2017-03-20

# Array.unsafe_get;;
- : 'a array -> int -> 'a = 
# Array.unsafe_set;;
- : 'a array -> int -> 'a -> unit = 
# Bytes.unsafe_get;;
- : bytes -> int -> char = 
# Bytes.unsafe_set;;
- : bytes -> int -> char -> unit = 

@vicuna vicuna closed this as completed May 20, 2017
@vicuna
Copy link
Author

vicuna commented May 20, 2017

Comment author: Eugene

But .mli files explicitly mentions that it's intended for system use only:
https://github.com/ocaml/ocaml/blob/4.05.0%2Bbeta3/stdlib/array.mli#L260

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

2 participants