Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Narrowing coercions for functions with optional parameters
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Tomasz Zielonka <zielony@c...>
Subject: Re: [Caml-list] Narrowing coercions for functions with optional parameters
On Mon, Feb 25, 2002 at 10:29:30AM +0900, Jacques Garrigue wrote:
> From: Tomasz Zielonka <zielony@cs.net.pl>
> 
> There is a common misunderstanding on the meaning of (e :> t).  It
> indeed allows some kind of coercion, but it does it by building a
> generic subtype of t, which is then unified to the type of e.
> [...]

Thanks for explanation.

> So the answer is: because implicit "coercions" work ok on some
> specific syntactical cases, but cannot easily be generalized to full
> coercions.
> 
> So, you are stuck with (fun x -> g x), which is in fact shorter than
> (g : ?add:int -> int -> int :> int -> int).

No problem.

PS. Labels in OCaml are great :)

tom

-- 
   .-.   Tomasz Zielonka                           CYBER SERVICE
   oo|   programista                        http://www.cs.net.pl
  /`'\   zielony@cs.net.pl
 (\_;/)  tel: [48] (22) 723-06-79 | tel/fax: [48] (22) 723-01-75
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners