From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id DFAEB7EFCD for ; Wed, 29 Oct 2014 15:30:25 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of Sebastien.Hinderer@inria.fr) identity=pra; client-ip=140.77.166.138; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="SRS0=Voyz=7U=inria.fr=Sebastien.Hinderer@bounce.ens-lyon.org"; x-sender="Sebastien.Hinderer@inria.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of SRS0=Voyz=7U=inria.fr=Sebastien.Hinderer@bounce.ens-lyon.org) identity=mailfrom; client-ip=140.77.166.138; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="SRS0=Voyz=7U=inria.fr=Sebastien.Hinderer@bounce.ens-lyon.org"; x-sender="SRS0=Voyz=7U=inria.fr=Sebastien.Hinderer@bounce.ens-lyon.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@sonata.ens-lyon.org designates 140.77.166.138 as permitted sender) identity=helo; client-ip=140.77.166.138; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="SRS0=Voyz=7U=inria.fr=Sebastien.Hinderer@bounce.ens-lyon.org"; x-sender="postmaster@sonata.ens-lyon.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuEBAAn5UFSMTaaKmWdsb2JhbABcg2JNC4MGyxOBYYcjAQEBAQERAQEBAQEICwsHFC6EAwEBAwEjDwFLCwsaAgUTDgICDy0biFEJBbIglSeBLI51gQWCYTaBHgWPbYZohxKBMos8hUiFSjcggVtrgksBAQE X-IPAS-Result: AuEBAAn5UFSMTaaKmWdsb2JhbABcg2JNC4MGyxOBYYcjAQEBAQERAQEBAQEICwsHFC6EAwEBAwEjDwFLCwsaAgUTDgICDy0biFEJBbIglSeBLI51gQWCYTaBHgWPbYZohxKBMos8hUiFSjcggVtrgksBAQE X-IronPort-AV: E=Sophos;i="5.04,810,1406584800"; d="scan'208";a="103573566" Received: from domu-toccata.ens-lyon.fr (HELO sonata.ens-lyon.org) ([140.77.166.138]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 29 Oct 2014 15:30:25 +0100 Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id 530E620093 for ; Wed, 29 Oct 2014 15:30:25 +0100 (CET) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sR9Q_oye2E8U for ; Wed, 29 Oct 2014 15:30:25 +0100 (CET) Received: from pema.homeunix.org (unknown [132.227.125.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 250792008F for ; Wed, 29 Oct 2014 15:30:25 +0100 (CET) Received: from seb by pema.homeunix.org with local (Exim 4.84) (envelope-from ) id 1XjUGX-0004J3-Mv for caml-list@inria.fr; Wed, 29 Oct 2014 15:30:25 +0100 Date: Wed, 29 Oct 2014 15:30:25 +0100 From: =?utf-8?Q?S=C3=A9bastien?= Hinderer To: caml-list@inria.fr Message-ID: <20141029143025.GA16501@pema> Mail-Followup-To: caml-list@inria.fr References: <20141023121202.GA22996@pl-59055.rocqadm.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Caml-list] Filename.temp_dir_name 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 >