From: Lukasz Stafiniak <lukstafi@gmail.com>
To: Edgar Friendly <thelema314@gmail.com>
Cc: Caml <caml-list@inria.fr>
Subject: Re: [Caml-list] Tuples (covariant immutable arrays)
Date: Wed, 14 Mar 2012 22:12:29 +0100 [thread overview]
Message-ID: <CAJMfKEXbbFrRu1pFY_dWE3iN6F0sb=i-4OViMVRBbOr0v+ka+g@mail.gmail.com> (raw)
In-Reply-To: <CAL-jcAnLOTWkSt3nUu4M4TMBr4JhLSS6W7B7+Fi4VCFY2XPu3g@mail.gmail.com>
On Wed, Mar 14, 2012 at 10:03 PM, Edgar Friendly <thelema314@gmail.com> wrote:
> Batteries has a Cap submodule that provides type-level protection for arrays
> so they can be Read-only/Write-only/Read-write. The same idea with a
> variance annotation and just read-only access seems to be what you're
> looking for, no?
It seems no, because Cap is invariant, and for a reason: for example,
Hashtbl.Cap.of_table says
"This operation involves no copying. In other words, in let cap =
of_table a in ..., any modification in a will also have effect on cap
and reciprocally."
What I'm thinking about is type +'a Tuple.t with Tuple.of_list and
Tuple.of_array both performing a copy.
next prev parent reply other threads:[~2012-03-14 21:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-14 20:38 Lukasz Stafiniak
2012-03-14 21:03 ` Edgar Friendly
2012-03-14 21:12 ` Lukasz Stafiniak [this message]
2012-03-14 21:26 ` Edgar Friendly
2012-03-14 22:18 ` Alexandre Pilkiewicz
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='CAJMfKEXbbFrRu1pFY_dWE3iN6F0sb=i-4OViMVRBbOr0v+ka+g@mail.gmail.com' \
--to=lukstafi@gmail.com \
--cc=caml-list@inria.fr \
--cc=thelema314@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