From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA19424; Fri, 25 Jul 2003 03:52:09 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA19942 for ; Fri, 25 Jul 2003 03:52:07 +0200 (MET DST) Received: from wetware.com (wetware.wetware.com [199.108.16.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h6P1q6f15721 for ; Fri, 25 Jul 2003 03:52:06 +0200 (MET DST) Received: from ra07 ([199.108.16.87] helo=wetware.com) by wetware.com with esmtp (Exim 4.20) id 19frkb-0004WE-D4 for caml-list@inria.fr; Thu, 24 Jul 2003 18:52:05 -0700 Date: Thu, 24 Jul 2003 18:52:07 -0700 Subject: Re: [Caml-list] Re: findlib-0.8.1 and ocaml-3.07+beta1 Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) From: james woodyatt To: The Trade Content-Transfer-Encoding: 7bit In-Reply-To: <3F2087BF.5080903@1969.ws> Message-Id: <98E41980-BE42-11D7-AF49-000393BA7EBA@wetware.com> X-Mailer: Apple Mail (2.552) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; woodyatt:01 jhw:01 wetware:01 caml-list:01 findlib-:01 3.07:01 covariant:01 expansive:01 forall:01 functors:01 val:01 functor:01 struct:01 3.06:01 3.06,:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thursday, Jul 24, 2003, at 18:28 US/Pacific, Karl Zilles wrote: > james woodyatt wrote: >> I'm specifically excited about the polymorphic generalization of >> covariant parts of expansive expressions. > > I read about this in the changes document, but I'm unable to wrap my > head around it. > > > For instance, if f: unit -> 'a list, "let x = f ()" > > gives "x" the generalized type forall 'a. 'a list, instead of '_a > list > > as before. > > Can someone simplify this for me? Under what circumstances would this > be useful? Sure. I see it with functors. Consider the following example: # module type X = sig type +'a t val f: unit -> 'a t end;; This is a module type I plan to use as the input to a functor. The top responds with this following: module type X = sig type +'a t val f : unit -> 'a t end So, imagine you want to write a functor like so: # module Y(X: X) = struct let x = X.f () end;; Here's what the 3.06 top-level says is the type of that module: module Y : functor (X : X) -> sig val x : '_a X.t end Here's what the 3.07+beta1 version says: module Y : functor (X : X) -> sig val x : 'a X.t end This is so much better. In the 3.06 case, I get a module whose type isn't complete yet. In the 3.07+beta1 case, I get a module whose type is complete. With 3.06, I have to write 'x' as a function that returns a constructed object every time I call it. With 3.07+beta1, I can write 'x' as a value that gets constructed once when the functor is called. -- j h woodyatt that's my village calling... no doubt, they want their idiot back. ------------------- 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