caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Drup <drupyog+caml@zoho.com>
To: Dhek Uir <dhekuir@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] Simple compression library
Date: Mon, 02 Feb 2015 17:48:01 +0100	[thread overview]
Message-ID: <54CFAA41.20706@zoho.com> (raw)
In-Reply-To: <CAJn4uc68NwoYOcViJemZvzqG-3dBiskToFn1vNwC9_cg+iiAJA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]

input/output_value are using Marshal under the hood, so it's going to be 
the same.

However, be aware that marshall (and the _value functions) are quite 
unsafe. If you have an error in the data (or your change the 
representation in OCaml), you will have ... surprising errors (including 
segfaults).

There are plenty of safer solutions for serialization (deriving, sexp, 
yojson, to name a few).

Le 02/02/2015 17:05, Dhek Uir a écrit :
>
>
> On Mon, Feb 2, 2015 at 4:43 PM, Jacques-Henri Jourdan 
> <jacques-henri.jourdan@inria.fr 
> <mailto:jacques-henri.jourdan@inria.fr>> wrote:
>
>     Le 02/02/2015 16:39, Dhek Uir a écrit :
>     > I'm looking for a compression library such as camlzip to read/write
>     > compressed files (any lossless compression algorithm is fine), but
>     > having a function similar to Pervasives.output_value, which does not
>     > seem to be available in camlzip (and I do not see how I could easily
>     > implement it).
>     >
>     > Would it be simple to modify camlzip to add this function? I believe
>     > that if this were the case, then it would already have been
>     done, but
>     > I might be wrong.
>     >
>     > Otherwise, is there another OCaml library with an API very
>     similar to
>     > Pervasives'? I'd prefer a lightweight solution (avoiding Core and
>     > Batteries) if possible.
>
>     Can't you do Marshal.to_string, and then use Camlzip on the generated
>     string ?
>
> Indeed, I can. I believe the hard part is actually the input_value 
> operation.
> But I haven't looked enough into Marshal, maybe my solution can be 
> found there.


[-- Attachment #2: Type: text/html, Size: 3211 bytes --]

  reply	other threads:[~2015-02-02 16:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 15:39 Dhek Uir
2015-02-02 15:43 ` Jacques-Henri Jourdan
2015-02-02 16:05   ` Dhek Uir
2015-02-02 16:48     ` Drup [this message]
2015-02-02 17:00       ` Dhek Uir
2015-02-02 17:38         ` David Allsopp
2015-02-02 17:53           ` Dhek Uir

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CFAA41.20706@zoho.com \
    --to=drupyog+caml@zoho.com \
    --cc=caml-list@inria.fr \
    --cc=dhekuir@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).