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 q2ELCs4N024329 for ; Wed, 14 Mar 2012 22:12:54 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqIBAFgJYU/RVdS0kGdsb2JhbABDtiUIIgEBAQEJCQ0HFAQjggkBAQEEEgIsARsdAQMMBgULAwouIQEBEQEFARwGEyKHaJxwCowQgnGFNz+IdAEFC4k/hzUElVaLLoMbPYQJ X-IronPort-AV: E=Sophos;i="4.73,586,1325458800"; d="scan'208";a="136110032" Received: from mail-wi0-f180.google.com ([209.85.212.180]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 14 Mar 2012 22:12:49 +0100 Received: by wibhm17 with SMTP id hm17so2911574wib.9 for ; Wed, 14 Mar 2012 14:12:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=7v3alg6Q6z57QPv42PXx+dTx4YTLTm3juoKM2jV3xvY=; b=X6K0h2HUnUm52ja/A3kjjt13Wmi+u6Ld4fChwuoyuP/pUG9OzrUcY+sw02nY4wyt1F sbq1fAzoEFtJo7tDIkLCu86OYc6fyoH0LoRJQKCG9IA+NctRVaN/z+K1P/xyNRdjoFWu akqqeclWPA60uwDqDPJAHehCOlLlB8/eFEXCNxMQpef/2n7TwOj1RHwnIY/HayglspDf R2aiF/qDx02OBMm3Y1snIao9SqRkLSoYh6+OYmGdKagzJ5VsGVjiiHDUbUzoJsVZYVW6 M09smM/pGopCRNW2pXy2CkMyvY1fOw8WQ4XDIAUHEtsxLqGoZum26eQzW/nrBQ+CITKY lMNA== Received: by 10.180.100.228 with SMTP id fb4mr9905682wib.1.1331759569253; Wed, 14 Mar 2012 14:12:49 -0700 (PDT) MIME-Version: 1.0 Received: by 10.180.19.97 with HTTP; Wed, 14 Mar 2012 14:12:29 -0700 (PDT) In-Reply-To: References: From: Lukasz Stafiniak Date: Wed, 14 Mar 2012 22:12:29 +0100 Message-ID: To: Edgar Friendly Cc: Caml Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q2ELCs4N024329 Subject: Re: [Caml-list] Tuples (covariant immutable arrays) On Wed, Mar 14, 2012 at 10:03 PM, Edgar Friendly 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.