caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Marie Gaillourdet <jmg@informatik.uni-kl.de>
To: Piotr Wieczorek <p.wieczorek@epf.pl>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Retyping module to a new signature
Date: Wed, 28 Jun 2006 17:45:09 +0200	[thread overview]
Message-ID: <86804392-80E8-4968-89CC-6ECDF6DC128A@informatik.uni-kl.de> (raw)
In-Reply-To: <200606281050.k5SAo4ee008939@nez-perce.inria.fr>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEoqQJNIUNP/I5YOgRAg5EAJ9TEP3e+8MlNxqx1jhBV3uAicjuHQCglSLw
JBc3ol9wBQ0ivgcrlbw3K0I=
=wQlS
-----END PGP SIGNATURE-----


  reply	other threads:[~2006-06-28 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-28 10:49 Piotr Wieczorek
2006-06-28 15:45 ` Jean-Marie Gaillourdet [this message]
2006-06-29  9:19   ` [Caml-list] " Piotr Wieczorek
2006-06-29  9:20     ` Jean-Marie Gaillourdet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86804392-80E8-4968-89CC-6ECDF6DC128A@informatik.uni-kl.de \
    --to=jmg@informatik.uni-kl.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=p.wieczorek@epf.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).