package core_kernel

  1. Overview
  2. Docs
Industrial strength alternative to OCaml's standard library

Install

Dune Dependency

Authors

Maintainers

Sources

core_kernel-v0.16.0.tar.gz
sha256=e37370bad978cfb71fdaf2b1a25ab1506b98ef0b91e0dbd189ffd9d853245ce2

doc/core_kernel.weak_array/Weak_array/index.html

Module Weak_arraySource

Module for dealing with weak pointers, i.e., pointers that don't prevent garbage collection of what they point to.

This module is like the OCaml standard library module of the same name, except that it requires that the values in the weak set are heap blocks.

Sourcetype 'a t
Sourceval sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
Sourceval create : len:Base.int -> _ t
Sourceval length : _ t -> Base.int
Sourceval set_exn : 'a t -> Base.int -> 'a Base.option -> Base.unit

set_exn raises an exception if given Some x with x not being a heap block. This is in addition to raising exceptions on bounds violation as set does.

Sourceval is_some : _ t -> Base.int -> Base.bool
Sourceval is_none : _ t -> Base.int -> Base.bool
Sourceval iter : 'a t -> f:('a -> Base.unit) -> Base.unit
Sourceval iteri : 'a t -> f:(Base.int -> 'a -> Base.unit) -> Base.unit
Sourceval blit : src:'a t -> src_pos:Base.int -> dst:'a t -> dst_pos:Base.int -> len:Base.int -> Base.unit

Warning! blit often takes time linear in the size of the arrays, not in the size of the range being copied. This issue is being tracked in https://github.com/ocaml/ocaml/issues/9258.

Other than that, blit is generally preferred over get followed by set because, unlike get, it doesn't have to make the value strongly-referenced. Making a value strongly-referenced, even temporarily, may result in delaying its garbage collection by a whole GC cycle.

OCaml

Innovation. Community. Security.