Version française
Home     About     Download     Resources     Contact us    
Browse thread
Transforming of ASTs and polymorphic variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] Transforming of ASTs and polymorphic variants
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