From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id E7759BB81 for ; Thu, 1 Dec 2005 18:54:19 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jB1HsJb2010113 for ; Thu, 1 Dec 2005 18:54:19 +0100 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 SAA13483 for ; Thu, 1 Dec 2005 18:54:18 +0100 (MET) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jB1HsG8Y010109 for ; Thu, 1 Dec 2005 18:54:17 +0100 Received: from rosella (ppp33-4.lns1.syd6.internode.on.net [59.167.33.4]) by ash25e.internode.on.net (8.12.9/8.12.6) with ESMTP id jB1Hs7pG058063; Fri, 2 Dec 2005 04:24:09 +1030 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] How to compile different implementations of the same lib From: skaller To: Christophe Raffalli Cc: Jacques Garrigue , daniel.buenzli@epfl.ch, caml-list@inria.fr In-Reply-To: <438F2CE5.9030105@univ-savoie.fr> References: <20051130.211930.102965761.garrigue@math.nagoya-u.ac.jp> <4F70401E-AE91-4E5E-AF67-70FBDCC7C353@epfl.ch> <20051201.100719.07647797.garrigue@math.nagoya-u.ac.jp> <438F2CE5.9030105@univ-savoie.fr> Content-Type: text/plain Date: Fri, 02 Dec 2005 04:54:07 +1100 Message-Id: <1133459647.9266.20.camel@rosella> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 438F38CB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 438F38C8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 lib:01 christophe:01 raffalli:01 ocaml:01 cmx:01 cmi:01 cmx:01 ocaml:01 compilation:01 model:01 abstraction:01 indirection:01 compiler:01 compiler:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Thu, 2005-12-01 at 18:03 +0100, Christophe Raffalli wrote: > May be I still do not get the problem Simple. Ocaml cheats. When you *compile* against a cmx or cmi/cmx pair, Ocaml 'cheats' and lifts non-interface information out of the cmx. This allows it to, for example, inline functions by cheating and grabbing their implementations from the cmx. This 'cheating' is typesafe and transparent at the program code level but NOT the compilation model level. To enforce abstraction, you have to ensure the cmx is not present when the dependent module is compiled, this forces the generated code to use indirection (closures, etc) -- marginally later binding at the cost of some performance. Given how fast the Ocaml compiler is it hardly seems worth bothering to me -- it's not as though you can link Ocaml code without the compiler. -- John Skaller Felix, successor to C++: http://felix.sf.net