caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Cedric Cellier <rixed@happyleptic.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Articles on using types for enhancing sw-quality?
Date: Mon, 09 Apr 2012 07:37:48 +0200	[thread overview]
Message-ID: <1333949868.9770.2.camel@Nokia-N900> (raw)
In-Reply-To: <CAPFanBFtrMSo5WPm8SSRjYhmvzs_zQJMtPsFg-vJcFX9hhutzg@mail.gmail.com>

 
> - 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?

  reply	other threads:[~2012-04-09  5:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-07 15:14 oliver
2012-04-07 16:45 ` Gabriel Scherer
2012-04-09  5:37   ` Cedric Cellier [this message]
2012-04-09  6:51     ` Gabriel Kerneis
2012-04-09  7:11       ` Gabriel Scherer
2012-04-09 17:43   ` oliver
2012-04-08  9:46 ` Daniel Bünzli

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=1333949868.9770.2.camel@Nokia-N900 \
    --to=rixed@happyleptic.org \
    --cc=caml-list@inria.fr \
    /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).