package unmagic

Not available on OCaml 5.5
  1. Overview
  2. Docs
Runtime tag-checking of marshaled ocaml data

Install

dune-project
 Dependency

Authors

Maintainers

Sources

unmagic-1.0.4.tar.bz2
sha256=365579df41ff676f949063480f9d9a57477ac8158b7c2eaec4387990d98bdc79
md5=bf81da1b8d3048edd5e6d5e25218a4bc

Description

Unmagic is a small library to runtime tag-check Obj.t values for type-secure Obj.magic, input_value, Marshal.from_channel. It uses typerep to give the target type, and follows the same limitations of it.

Added to opam-repository:

README

Unmagic: runtime type checking of OCaml marshaled (streamed) data

Unmagic is a library to dynamically type check Obj.t data to assure safety of their coercions to expected types. It uses Typerep for the representation of data types. Secured version of Obj.obj, Unmagic.obj has the following type:

val obj : sharing:bool -> 'a Typerep.t -> Obj.t -> 'a

obj ~sharing (tyrep : ty Typerep.t) o checks the value of Obj.t can be safely coerced to a value of type ty. If the check succeeds it returns the coerced value of type ty. Otherwise, it raises an exception Ill_typed.

The parameter ~sharing:true enables sharing and cycle detection: it avoids repeating type checks of shared nodes and cycles which are already visited with the same types. It makes the type checking very slow but is necessary for data with cycles. Type checking may never terminates for cyclic data with ~sharing:false.

Dev Dependencies

None

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building unmagic with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
1.0.4 (this version) good n/a n/a n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure