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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id DDF5DBB84 for ; Thu, 29 Jun 2006 11:13:58 +0200 (CEST) Received: from mail133.pi.net.pl (gips.pi.net.pl [195.116.221.99]) by nez-perce.inria.fr (8.13.6/8.13.6) with SMTP id k5T9Dwvb025534 for ; Thu, 29 Jun 2006 11:13:58 +0200 Received: (qmail 18316 invoked from network); 29 Jun 2006 09:13:45 -0000 Received: from unknown (HELO piotrgqd2wjase) (p.wieczorek@62.179.90.174) by 195.205.153.133 with SMTP; 29 Jun 2006 09:13:45 -0000 Message-ID: <005801c69b5d$1d39d130$ae5ab33e@piotrgqd2wjase> From: "Piotr Wieczorek" To: "Jean-Marie Gaillourdet" Cc: References: <200606281050.k5SAo4ee008939@nez-perce.inria.fr> <86804392-80E8-4968-89CC-6ECDF6DC128A@informatik.uni-kl.de> Subject: Re: [Caml-list] Retyping module to a new signature Date: Thu, 29 Jun 2006 11:19:24 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.2663 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.3790.2663 X-Miltered: at nez-perce with ID 44A399D6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ocaml:01 compiler:01 bytecode:01 foo:01 byte:01 foo:01 cmo:01 mli:01 val:01 ocamlc:01 ocamlc:01 mli:01 cmo:01 binary:01 wrote: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=RCVD_BY_IP autolearn=disabled version=3.0.3 > Hi, > > On 28.06.2006, at 12:49, Piotr Wieczorek wrote: > >> Hi! >> I'm trying for quite a time, to make patch to Ocaml compiler which makes >> possible taking a bytecompiled module and producing identical module but >> conforming to a new signature. >> I've used some code from bytepackager to calculate coercion and copy >> bytecode from original module to target one. >> It works ok. But if order of functions in target signature is different >> then in source signature, calling a function may cause not running right >> one, but another. >> Can you tell me what may I be doing wrong, or wether what i'm trying to >> accomplish is possible. >> > > Why do you try do that in the first place? Let us assume you have a > module Foo which is stored in byte code file foo.cmo, which was compiled > frome the file foo.ml > - -- foo.ml -- > let foo x y= x + y > > let bar x = x > - ------------ > > If you want to constraint Foo to a module Bar which includes only the > first function you could use the following source: > - -- bar.mli ---- > val foo : int -> int -> int > - --------------- > - -- bar.ml ----- > include Foo > - --------------- > > I compiled everything with: > > $ ocamlc foo.ml > $ ocamlc bar.mli > $ ocamlc foo.cmo bar.ml > > The first step is in your step eventually not necessary, because you > wanted to start with a binary module. > Hope this helps. > > Best regards, > Jean-Marie Well, imagine following situation I got program as bunch of bytecompiled modules. Some of them are third-party libraries. Thereis new version of library released with compatible but not necessary identical signatures. I want now to have module with identical name as source module but consistent with new signature. Using Your method, I think, I cannot use the name name of new module as of the source module. Piotr Wieczorek ------------------------------------------------------------------------ CIEP?E KRAJE - CIEP?E MORZA. Szukasz atrakcyjnego wypoczynku w przyst?pnej cenie, zapoznaj si? z nasz? ofert?. ZAPRASZAMY www.skarpatravel.pl