caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Whitington <john@coherentgraphics.co.uk>
To: Sylvain Le Gall <sylvain@le-gall.net>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: OCaml / F# co-development
Date: Mon, 03 May 2010 17:14:44 +0100	[thread overview]
Message-ID: <4BDEF674.1010302@coherentgraphics.co.uk> (raw)
In-Reply-To: <slrnhttoe6.mc9.sylvain@gallu.homelinux.org>

Hi Benjamin,

On 03/05/2010 15:46, Sylvain Le Gall wrote:
> On 03-05-2010, Benjamin Pierce<bcpierce@cis.upenn.edu>  wrote:
>> Is anybody out there developing code in the common subset of OCaml and
>> F# so that it works with both compilers / libraries?  I'd be very
>> interested in hearing about the feasibility of this arrangement...
>>
>
> There was a series of blog posts by CoherentPDF on
> http://planet.ocamlcore.org 1 year ago.
>
> Here is one of them:
> http://coherentpdf.com/blog/?p=10
>
> Browse their archives to have more:
> http://www.coherentpdf.com/news-archive.html

The current release of CamlPDF does this, and it's about 15000 lines of 
Ocaml / F#.

http://www.coherentpdf.com/ocaml-libraries.html

You just have the occasional thing like this:

let digest =
   (*IF-OCAML*)
   Digest.string
   (*ENDIF-OCAML*)
   (*i*)(*F#
   function s ->
     let hasher = System.Security.Cryptography.MD5.Create () in
       string_of_int_array (intarray_of_bytearray (hasher.ComputeHash 
(bytearray_of_string s)))
   F#*)(*i*)

to account for the difference in standard libraries. And a little bit of 
messing around with the different syntax, for example writing

(!x).y

instead of !x.y

And you can't use labeled arguments or polymorphic variants.

But it's perfectly feasible. I converted said 15000 lines of code in a 
few days.

Cheers,

-- 
John Whitington
Director, Coherent Graphics Ltd
http://www.coherentpdf.com/


      reply	other threads:[~2010-05-03 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03 14:00 Benjamin Pierce
2010-05-03 14:46 ` Sylvain Le Gall
2010-05-03 16:14   ` John Whitington [this message]

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=4BDEF674.1010302@coherentgraphics.co.uk \
    --to=john@coherentgraphics.co.uk \
    --cc=caml-list@inria.fr \
    --cc=sylvain@le-gall.net \
    /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).