Version française
Home     About     Download     Resources     Contact us    
Browse thread
Best way to choose an implementation of a lib ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] How to compile different implementations of the same lib
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 <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net