From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 3E4097EEEF for ; Fri, 12 Jun 2015 10:38:15 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.13,601,1427752800"; d="scan'208";a="135819630" Received: from meleze.ens.fr (HELO [129.199.99.114]) ([129.199.99.114]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 12 Jun 2015 10:38:14 +0200 Message-ID: <557A9A75.9040307@inria.fr> Date: Fri, 12 Jun 2015 10:38:13 +0200 From: Francois Berenger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: OCaml List References: <20150612052738.GA3684@pllab.is.ocha.ac.jp> In-Reply-To: <20150612052738.GA3684@pllab.is.ocha.ac.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Marshall.from_channel and segmentation fault On 06/12/2015 07:27 AM, Kenichi Asai wrote: > The OCaml manual for the Marshall module says: > >> (Marshal.from_channel chan : type). Anything can happen at run-time >> if the object in the file does not belong to the given type. > > and this "Anything" contains segmentation fault. Is it difficult to > avoid this segmentation fault and, e.g., raise an exception instead? Maybe bin_prot from janestreet is better for your use case. I think it will throw an exception if you try to unmarshal something of the wrong type. > Sincerely, > -- Regards, Francois. "When in doubt, use more types"