caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Sébastien Hinderer" <Sebastien.Hinderer@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Filename.temp_dir_name
Date: Wed, 29 Oct 2014 15:30:25 +0100	[thread overview]
Message-ID: <20141029143025.GA16501@pema> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D9E9658FD3@Remus.metastack.local>

Dear David,

Many thanks for your response.



David Allsopp (2014/10/23 12:50 +0000):
> If you need to write code for 4.x which is also backwards compatible,
> you'll need to introduce a compatibility layer - ExtLib/Batteries
> contain examples of how to do this (especially the Unix modules in
> Batteries, which have to allow for different constructors in different
> version of OCaml sum types).
>

 
> Essentially, you'll create something like CompatibilityLayer.ml which your build system will generate as:
> 
> module Filename = Filename
> 
> for OCaml >= 4.00.0, and:
> 
> module Filename = struct
>   include Filename
> 
>   let get_temp_dir_name = (* ... code for get_temp_dir_name *)
> 
>   (* ... any other 4.00.0 functions back-ported *)
> end
> 
> for OCaml < 4.00.0. Then in each of your actual source files you'll simply add
> 
> open CompatibilityLayer
> 
> at the top. See also the bytes package in findlib >= 1.5 (doing the same thing for the OCaml 4.02 Bytes module).

Thanks for the pointers. I had a look to the different projects you
mentionned but so far I couldn't find where in the sources the
compatibility layer was defined / generated.

I mean, I understand the principle of what you explain but I'd be happy
to see a concrete example illustrating how the buildsystem generates the
appropriate files depending on the compiler version.

Would it be possible for you to show me more precisely where this is
done, plese?

Thanks,
Sébastien.

> 
> HTH,
> 
> 
> David 
> 

  reply	other threads:[~2014-10-29 14:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 12:12 Sébastien Hinderer
2014-10-23 12:50 ` David Allsopp
2014-10-29 14:30   ` Sébastien Hinderer [this message]
2014-10-29 14:41     ` David Allsopp
2014-10-29 15:29       ` Sébastien Hinderer
2014-10-30  7:35         ` Gabriel Scherer
2014-10-30  9:22         ` Sylvain Pogodalla
2014-10-30  9:40           ` Daniel Bünzli
2014-10-30  9:49             ` David Allsopp
2014-10-30 10:04               ` Daniel Bünzli
2014-10-30  9:44           ` Sébastien Hinderer

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=20141029143025.GA16501@pema \
    --to=sebastien.hinderer@inria.fr \
    --cc=caml-list@inria.fr \
    /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).