From: David Allsopp <dra-news@metastack.com>
To: OCaml List <caml-list@inria.fr>
Subject: RE: [Caml-list] Libraries exporting external definitions in modules
Date: Thu, 2 Jan 2014 10:22:01 +0000 [thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9E028140D@Remus.metastack.local> (raw)
In-Reply-To: <1388241631.2837.7.camel@e130>
Thanks for the replies!
Gerd Stolpmann wrote:
> There is an easy workaround: Don't put the external declaration into the
> mli, just a val. When installing the library, take care to also include
> the cmx file. This way, the extra function wrapper can be eliminated by
> the automatic inliner of ocamlopt.
Ah, I didn't realise that that was one of the optimisations which installing the .cmx file allows. In fact, that seems to be a good case for *never* using external in the .cmi file, as that way you have transparent control over a future version which just might need to put an OCaml wrapper around the stub.
> Of course, this works only for native code.
True, but the introduction of native dynlink (on most platforms, at least) does seem to make worrying about very small optimisations (i.e. non-algorithmic) for bytecode silly :o)
Markus Mottl wrote:
> This bug report also describes this problem:
> http://caml.inria.fr/mantis/view.php?id=4166
ocamldoc/trunk/manual/cmds/intf-c.etex was updated by Damien at the end of November with a warning in the explanation of the [external] keyword that this can happen (was glad I spotted that *before* attaching a documentation patch to your PR!)
> I think this should get fixed. Though there is an easy (though slightly
> less efficient) workaround, this problem is pretty hard to identify,
> especially for people who have never seen it.
Judging by Jacques note connecting it to PR#6063 it will be soon - though given that installing the .cmx files enables the optimisation as well, I'm wondering if never using [external] in .mli files is actually the better route?
David
prev parent reply other threads:[~2014-01-02 10:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 13:27 David Allsopp
2013-12-27 14:14 ` Markus Mottl
2013-12-28 14:40 ` Gerd Stolpmann
2014-01-02 10:22 ` David Allsopp [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=E51C5B015DBD1348A1D85763337FB6D9E028140D@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;
as well as URLs for NNTP newsgroup(s).