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 RAA30080; Thu, 13 Jun 2002 17:36:23 +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 RAA29996 for ; Thu, 13 Jun 2002 17:36:22 +0200 (MET DST) Received: from web13406.mail.yahoo.com (web13406.mail.yahoo.com [216.136.175.64]) by concorde.inria.fr (8.11.1/8.11.1) with SMTP id g5DFaL927979 for ; Thu, 13 Jun 2002 17:36:21 +0200 (MET DST) Message-ID: <20020613153620.78279.qmail@web13406.mail.yahoo.com> Received: from [63.195.80.23] by web13406.mail.yahoo.com via HTTP; Thu, 13 Jun 2002 08:36:20 PDT Date: Thu, 13 Jun 2002 08:36:20 -0700 (PDT) From: Brian Naylor Subject: Re: [Caml-list] double-functors for types and values To: caml-list@inria.fr In-Reply-To: <20020613123311H.garrigue@kurims.kyoto-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk --- Jacques Garrigue wrote: > There 's something fishy in struct type btype = B.btype end: > if you're still inside B, you cannot refer to yourself as B. Whoops, sorry. You're right - the actual code uses more nested modules or type renaming, which I left out of the sample code. > Functors should incur three costs: > * type abstraction cost: if you depend on abstract types, some data > structure accesses cannot be optimized. I would like to see an example of an unoptimizable case > * function abstraction cost: all imported functions and (some?) > exported functions cannot be called directly. Expensive. So in the following code: module MakeA (A : sig type x end) = struct let foo = ... module MakeB (B : sig val quux : ... end) = struct let bar = ... end end Both [foo] and [bar] will not cost anything to evoke, but [quux] will cost an extra indirection since it was imported in the functor parameter? > * structure access cost: you have to dereference to get to your > closures. I believe it's cheap compared to the function abstraction > cost. Xavier Leroy had recently some figures showing that a method > call (double indirection) was not that much more expensive than an > abstract function call. Is this referring to closures over over local modules (using [let module]) only, or does it have an impact on top-level modules as well? Can someone come up with a link to the figures mentioned above? Thanks. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com ------------------- 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