From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q395c0pJ019788 for ; Mon, 9 Apr 2012 07:38:00 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqcCAFB1gk/UGyoEkWdsb2JhbABCgymCSrNHIgEBAQEJCwsHFAMkggoBAwIjDwFWCxoCJgICV4grB6wSii2BL4wHggyBGASWfYRhjS0 X-IronPort-AV: E=Sophos;i="4.75,392,1330902000"; d="scan'208";a="139526024" Received: from smtp4-g21.free.fr ([212.27.42.4]) by mail4-smtp-sop.national.inria.fr with ESMTP; 09 Apr 2012 07:37:54 +0200 Received: from [192.168.0.41] (unknown [82.229.213.209]) by smtp4-g21.free.fr (Postfix) with ESMTP id 33F034C8072 for ; Mon, 9 Apr 2012 07:37:49 +0200 (CEST) From: Cedric Cellier Reply-To: Cedric Cellier To: caml-list@inria.fr X-Mailer: Modest 3.2 References: <20120407151452.GA12887@siouxsie> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-ID: <1333949868.9770.1.camel@Nokia-N900> Date: Mon, 09 Apr 2012 07:37:48 +0200 Message-Id: <1333949868.9770.2.camel@Nokia-N900> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] Articles on using types for enhancing sw-quality? > - Chung-chieh Shan and Oleg's "Lightweight Static Capabilities" > presents several examples of phantom types and a general design method > to use them to enhance program safety: >  http://okmij.org/ftp/papers/lightweight-static-capabilities.pdf I attempted to read this one out of curiosity, and it raised a question: is there a way to write these unsafe functions (List.Unsafe.tail/head...) in pure OCaml? this code: let head (Cons (a, b)) = a would still generate code that check input constructor in order to raise an exception if it's not Cons (-unsafe command line parameter does not change this, regretably, according to the manual). Is there another way?