Browse thread
Transforming of ASTs and polymorphic variants
-
Joel Reymont
- Joel Reymont
-
skaller
-
Joel Reymont
- Martin Jambon
-
Joel Reymont
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-04-25 (06:28) |
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