Lightweight Typed Customizable Unmarshaling - Inria - Institut national de recherche en sciences et technologies du numérique Access content directly
Conference Papers Year : 2011

Lightweight Typed Customizable Unmarshaling


1. Abstract The contribution of this work is threefold. First, we offer an OCaml unmarshaling algorithm that uses a lightweight type-directed de-scription of the expected structure of data to make consistency checks. The second contribution is the opportunity to specify func-tions to be systematically applied on values as they are being un-marshaled. Our third contribution is a type-safe layer for these functions and for the unmarshaling algorithm itself. 2. Description The standard OCaml unmarshaling function is input value: in channel → α. The aforementioned first contribution is a function descr input val with type in channel → descr → α. One value of type descr that can be passed as second argu-ment is Abstract, and then the behavior is exactly identical to input value. The programmer can provide as much information as (s)he wants for the additional consistency checks. For instance, (s)he can pass the value (t array Abstract) to specify that the value being read is an array of undescribed values. Our unmar-shaling algorithm maintains a cursor into the structure description, allowing it to know what the current loaded value should look like.
Fichier principal
Vignette du fichier
unmarshal-final.pdf (131.79 Ko) Télécharger le fichier
Origin : Files produced by the author(s)

Dates and versions

hal-01091947 , version 1 (04-02-2015)


  • HAL Id : hal-01091947 , version 1


Pascal Cuoq, Julien Signoles, Damien Doligez. Lightweight Typed Customizable Unmarshaling. ACM SIGPLAN Workshop on ML, Sep 2011, Tokyo, Japan. ⟨hal-01091947⟩
229 View
81 Download


Gmail Facebook X LinkedIn More