From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 03C85BC69 for ; Wed, 25 Apr 2007 08:28:57 +0200 (CEST) Received: from out4.smtp.messagingengine.com (out4.smtp.messagingengine.com [66.111.4.28]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3P6SuAU023336 for ; Wed, 25 Apr 2007 08:28:56 +0200 Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id 29A07217E19; Wed, 25 Apr 2007 02:28:57 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 25 Apr 2007 02:28:56 -0400 X-Sasl-enc: c+Q+Fwh5iaVx917gFPkPDDo3Tmk0aBffIZvPEzZYf8u1 1177482536 Received: from adsl-75-18-115-219.dsl.sndg02.sbcglobal.net (adsl-75-18-115-219.dsl.sndg02.sbcglobal.net [75.18.115.219]) by mail.messagingengine.com (Postfix) with ESMTP id 4A25A15BFB; Wed, 25 Apr 2007 02:28:56 -0400 (EDT) Date: Tue, 24 Apr 2007 23:28:48 -0700 (PDT) From: Martin Jambon X-X-Sender: martin@droopy To: Joel Reymont Cc: skaller , Caml List Subject: Re: [Caml-list] Transforming of ASTs and polymorphic variants In-Reply-To: Message-ID: References: <15893C08-FD0C-456B-A12F-DADCF6CC95F9@gmail.com> <1177480445.7544.14.camel@rosella.wigram> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at concorde with ID 462EF528.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 transforming:01 variants:01 variants:01 2007,:98 polymorphic:01 polymorphic:01 wrote:01 caml-list:01 jambon:01 jambon:01 expression:02 conv:02 objects:02 let:03 On Wed, 25 Apr 2007, Joel Reymont wrote: > John, > >> let conv_type x = (x : A.typ :> B.ty) >> >> will also work in this case. > > Thanks for the tip! > > Can you explain the following expression? > > (x : A.typ :> B.ty) Basically you would use :> to convert the type of a value to a type which is more general. With polymorphic variants it allows you to "add" cases and with objects it allows you to "remove" methods. Martin -- Martin Jambon http://martin.jambon.free.fr