caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Harrison, John R" <johnh@ichips.intel.com>
To: "Martin Jambon" <martin_jambon@emailuser.net>,
	"Caml List" <caml-list@inria.fr>
Cc: "Harrison, John R" <johnh@ichips.intel.com>
Subject: RE: [Caml-list] Re: immutable strings (Re: Array 4 MB size limit)
Date: Mon, 29 May 2006 13:52:01 -0700	[thread overview]
Message-ID: <196F1D996F92CD46A542EA519DB8CE4703CCAACC@orsmsx409> (raw)

Hi Martin,

| OK, but let's be pragmatic: what kind of interface and implementation
do
| you have in mind?

I did indeed have a very specific example in mind, my theorem prover HOL
Light. I have an OCaml type of typed lambda-terms:

  type term =
      Var of string * hol_type
    | Const of string * hol_type
    | Comb of term * term
    | Abs of term * term

The type "term" is private, and the abstract type interface only permits
you to construct well-typed terms, via interface functions like "mk_var"
and "mk_comb". For example, the call "mk_comb(s,t)" gives "Comb(s,t)"
provided the types agree, and fails otherwise.

I would like the user to be able to write "mk_var(x,ty)" and the net
result to be just one cons "Var(x,ty)" with "x" and "ty" identical to
the
input arguments. But with mutable strings, it is possible in principle
for the string "x" inside that object to get modified by other code.
Of course, it's a bit artificial, but I would like it to be impossible,
given that the principle of LCF provers is that the user should be able
to use arbitrary programs while having soundness enforced by the ML
type system.

Of course, I can use my own private type of strings, but then I need
to convert every time I use standard library functions, pattern matching
is a bit less convenient, etc.

John.


             reply	other threads:[~2006-05-29 20:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-29 20:52 Harrison, John R [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-05-28 23:20 Harrison, John R
2006-05-29  2:36 ` Martin Jambon
2006-05-31 12:53 ` Jean-Christophe Filliatre
2006-05-15 18:12 Array 4 MB size limit akalin
2006-05-19  5:57 ` [Caml-list] " Frederick Akalin
2006-05-19 16:28   ` Jozef Kosoru
2006-05-19 21:26     ` Jon Harrop
2006-05-20  1:06       ` Brian Hurt
2006-05-20 21:11         ` immutable strings (Re: [Caml-list] Array 4 MB size limit) Oliver Bandel
2006-05-25  4:32           ` immutable strings (Re: " Stefan Monnier
2006-05-25  5:56             ` [Caml-list] " Martin Jambon
2006-05-25  7:23               ` j h woodyatt
2006-05-25 10:22                 ` Jon Harrop
2006-05-25 19:28                 ` Oliver Bandel
2006-05-25 11:14               ` Brian Hurt
2006-05-25 19:42                 ` Oliver Bandel
2006-05-26  6:51                 ` Alain Frisch
2006-05-25 17:31               ` Aleksey Nogin
2006-05-25 19:54                 ` Martin Jambon
2006-05-25 11:18             ` Brian Hurt
2006-05-25 17:34               ` Aleksey Nogin
2006-05-25 18:44                 ` Tom
2006-05-25 23:00                   ` Jon Harrop
2006-05-25 23:15                     ` Martin Jambon

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=196F1D996F92CD46A542EA519DB8CE4703CCAACC@orsmsx409 \
    --to=johnh@ichips.intel.com \
    --cc=caml-list@inria.fr \
    --cc=martin_jambon@emailuser.net \
    /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).