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

request for Weak.set_some function #5792

Closed
vicuna opened this issue Oct 15, 2012 · 2 comments
Closed

request for Weak.set_some function #5792

vicuna opened this issue Oct 15, 2012 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Oct 15, 2012

Original bug ID: 5792
Reporter: sweeks
Assigned to: @damiendoligez
Status: resolved (set by @alainfrisch on 2016-12-08T10:42:57Z)
Resolution: suspended
Priority: normal
Severity: feature
Category: standard library

Bug description

Could we get the following function added to the [Weak] module?

val set_some : 'a t -> int -> 'a -> unit

It would satisfy the equation:

set_some t i a = set t i (Some a)

but would have the benefit that one is not forced to allocate a [Some]
block.

@vicuna
Copy link
Author

vicuna commented Jun 6, 2013

Comment author: bjeannet

I would be also glad also to have such a function.

  1. It is not practical to implement it as a normal programmer, because one needs access to .h files that are not installed by the compiler.

  2. It is a trivial addition.

  3. I tried it (by modifying directly byterun/weak.c), and on a benchmark where I used to Weak arrays for memoization (modification of Filliatre BDD library), I gained 10%.

@vicuna
Copy link
Author

vicuna commented Dec 8, 2016

Comment author: @alainfrisch

Sounds like a useful addition to make. Marking this as "Suspended" for now, but a PR is welcome!

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