From: David Allsopp <dra-news@metastack.com>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: RE: [Caml-list] Filename.temp_dir_name
Date: Thu, 23 Oct 2014 12:50:20 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9E9658FD3@Remus.metastack.local> (raw)
In-Reply-To: <20141023121202.GA22996@pl-59055.rocqadm.inria.fr>
Sébastien Hinderer wrote:
> Dear all,
>
> In Ocaml 4.02.0, filename.mli says that temp_dir_name is deprecated since
> 3.09.1 and that get_temp_dir_name should be used instead, but this
> function does not seem to be deined in e.g.the sources of ocaml-
> 3.10.0+beta.
You've not quite read the sources correctly - the function temp_dir_name was *introduced* in 3.09.1 (that's the @since) and deprecated in 4.00.0 when get_temp_dir_name was introduced (deprecated functions became a bit more visible in 4.02 because of the new [@@deprecated] attribute - although warning 3 existed, I think that was only language features beforehand).
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).
HTH,
David
next prev parent reply other threads:[~2014-10-23 12:50 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 [this message]
2014-10-29 14:30 ` Sébastien Hinderer
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=E51C5B015DBD1348A1D85763337FB6D9E9658FD3@Remus.metastack.local \
--to=dra-news@metastack.com \
--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