[cwn] Attn: Development Editor, Latest OCaml Weekly News

Alan Schmitt alan.schmitt at polytechnique.org
Tue Dec 17 03:59:50 PST 2013


Hello,

Here is the latest OCaml Weekly News, for the week of December 10 to 17, 2013.

1) opam-installer (beta)
2) ocamlbuild plugins and external libraries
3) Dead code detection
4) InvarGenT: GADTs-based invariant/postcondition generation
5) Symbolizer for caml-inspect
6) OASIS v0.4.0
7) cryptodbm.0.8: key-value database with encryption
8) Lablqt
9) SDL2 bindings, testers and feedback welcome
10) Other OCaml News

========================================================================
1) opam-installer (beta)
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00068.html>
------------------------------------------------------------------------
** Daniel Bünzli asked, said, then Louis Gesbert announced:

> > Manual Package Management?, the file format of .install is very
> > simple you could perfectly develop have a command line tool that reads
> > it and issues the appropriate cp commands,
> 
> In fact, thanks to Louis Gesbert, this tool already seems to exist since 17 days:
> 
> <https://github.com/ocaml/opam/pull/1026>

Hah, Daniel, you're too fast, it actually just landed into OPAM trunk just now !
So here is the official announcement :)

OPAM now installs together with a small opam-installer script designed
just towards that goal: it handles .install files, and can be used to
install or remove any package that generates them, independently of
OPAM. Hopefully this will help the acceptation of this format as a
standard, both easing the programmer's (and build-system writer's) work
and providing better integration with the packaging system.

Additionally, opam-installer can generate shell-scripts that could be
used, for example, for distributing to targets which don't have the
tool.

This is still in beta stage, all reports welcome.
      
========================================================================
2) ocamlbuild plugins and external libraries
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00074.html>
------------------------------------------------------------------------
** Gregory Malecha asked and Gabriel Scherer replied:

> I have several ocamlbuild plugins that are very similar and I'm trying
> to figure out how to refactor them. I pulled out a bunch of definitions
> into another file (coq_paths.ml) and then said 'open Coq_paths' in '
> myocamlbuild.ml'. But when I do this, ocamlbuild can no longer build the
> plugin, not even if foo.cmo already exists in the _build directory.
> 
> After hacking on this for a long time (and digging through the
> ocamlbuild sources) I found that you can write a Makefile that will
> build myocamlbuild.cmo using ocamlbuild without a plugin, and then
> manually link this against ocamlbuild.cmo and to produce a custom
> version of ocamlbuild that uses the plugin (this is exactly what
> ocamlbuild does). My question is: 'is there any nicer way to do this?'
> I'm including my Makefile below:
> 
> OCAMLBUILDDIR=$(shell ocamlfind query ocamlbuild)
> 
> all: _build/coq_builder
> @ ./_build/coq_builder -no-plugin coq.otarget
> 
> _build/coq_builder: myocamlbuild.ml coq_paths.ml
> @ echo "building builder...."
> @ ocamlbuild -cflags -I,`ocamlfind query ocamlbuild` -no-plugin
> myocamlbuild.cmo
> @ ocamlc.opt unix.cma -I $(OCAMLBUILDDIR) $
> (OCAMLBUILDDIR)/ocamlbuildlib.cma \
> _build/coq_paths.cmo _build/myocamlbuild.cmo \
> $(OCAMLBUILDDIR)/ocamlbuild.cmo -o _build/coq_builder
> @ echo "done"
> 
> clean:
> ocamlbuild -clean

Since 4.01, ocamlbuild supports a new (experimental) option
"-plugin-tag" that allows to specify (built-in) ocamlbuild tags to use
when compiling myocamlbuild.ml. If you package coq-paths using findlib,
you can then use

ocamlbuild -use-ocamlfind -plugin-tag "package(coq-path)" ...
      
========================================================================
3) Dead code detection
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00078.html>
------------------------------------------------------------------------
** Pierre-Yves Strub asked:

Does any of you know a tool for doing dead code detection?
      
** Simon Cruanes replied:

I don't use such a tool but I remember that Ocamlpic contains something
similar for shrinking bytecode files. See
<http://www.algo-prog.info/ocaml_for_pic/web/index.php?id=OCAPIC:OCamlClean>

It would be great to have such a standalone tool on opam, though.
      
** Fabien Renaud also suggested:

You can try <https://github.com/Michaaell/dead-code-detection> (which
requires OCaml 4).
      
** Alain Frisch also suggested:

At LexiFi, we use two different techniques for detecting dead code:

 - Bisect, for a dynamic notion of "dead code" (i.e. code which is not
exercised by our testsuite).

 - A custom static detection tool, which parses .cmt and .cmi files to
detect exported components (values, exceptions, etc) used by no other
module in the project.  This is of course combined with the existing
compiler warnings on locally unused and non-exported declarations.

The next version of OCaml will make it extremely simple to implement
such a static detection tool.  This is because of the new -keep-locs
compiler flag, which allows us to keep the location of exported values
in .cmi files, and thus retrieve the same locations on references to
such values in .cmt files.  It makes it very easy to create the link
between an exported value and its references in external modules, even
if this goes through e.g. module inclusions.  As a proof of concept of
this approach, we can already try the tool
experimental/frisch/unused_exported_values.ml in the trunk:

<http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/trunk/experimental/frisch/unused_exported_values.ml?revision=HEAD&view=markup>

(-keep-locs also gives "for free" a jump-to-definition feature, just by
parsing .cmt or .annot files.)
      
** Oliver also suggested:

-w flags for
    suspicious comment
    partially applied function
    overriden methods
    non-unit statement
    overriden instance variables
  * suspicious unused variables
  * all other unused variables

Especially unused variables may show lurking code,
that was once written in an intermediate state of
code development, and never be used again since then.
      
** Yoann Padioleau also suggested:

I made a tool using the .cmt format that visualizes code dependencies:
<https://github.com/facebook/pfff/wiki/CodeGraph>
<https://github.com/facebook/pfff/blob/master/main_codegraph.ml>
<https://github.com/facebook/pfff/wiki/Main>

It also highlights dead code (at different granularities, dead
directories,
dead files, dead functions, etc).
      
========================================================================
4) InvarGenT: GADTs-based invariant/postcondition generation
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00085.html>
------------------------------------------------------------------------
** Lukasz Stafiniak announced:

I am pleased to release the first version of InvarGenT, a system that
performs full type inference for a type system with GADTs, and also
generates new GADTs to serve as existential types. In addition to
algebraic types, the first version handles linear arithmetic
constraints.

<https://github.com/lukstafi/invargent/releases/tag/v1.0>
      
========================================================================
5) Symbolizer for caml-inspect
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00088.html>
------------------------------------------------------------------------
** Peter Zotov announced:

Caml-inspect is a useful tool, but the way it displays closures (just
a memory address) is awful. I wrote a symbolizer for caml-inspect
generated
dot files.

Code and examples are in this gist:
<https://gist.github.com/whitequark/7924109>

I hope someone else will find this useful.
      
========================================================================
6) OASIS v0.4.0
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00094.html>
------------------------------------------------------------------------
** Sylvain Le Gall announced:

I am pleased to announce that OASIS v0.4.0 has been released.

This new release contains a lot of fixes contributed by users who
kindly send me back their patches and pull-request.

* Migrate the source repository to <https://github.com/ocaml/oasis>
* Fix a lot of code style issues (e.g. blank at the end of the line)
and create a test to check that the style of generated files is
correct. Some related tools has been fixed asi well, for the best
formatting use ocamlmod >= 0.0.7 and ocaml-data-notation >= 0.0.10.
* Port all tests to OUnit 2.0, which allows to run all tests faster.
* Run some tests with a fake bytecode only setup, so that we can
always check that bytecode and nativecode tests are passing.  (Closes:
#1306)
* Fix a missing dependency on ocamlbuild package and inclusion of
ocambuildlib.cma in builtin-plugins.cma.

* Introduce a framework to create features.
 * Add fields AlphaFeatures and BetaFeatures to list the experimental
features you want to use in your _oasis
 * Using AlphaFeatures and BetaFeatures is only allowed if OASISFormat
is set to the latest OASIS version. There is no backward compatiblity
for experimental features. For example, if you are using OASIS 0.4.X,
OASISFormat must be set to 0.4.
* AlphaFeatures represents features not fully completed that maybe
very unstable, quickly evolving and even removed in future release.
* BetaFeatures represents features almost finished that needs to
mature a bit before being published.

Read more of this announcement here:
<http://le-gall.net/sylvain+violaine/blog/index.php?post/2013/12/11/Release-of-OASIS-0.4.0>
      
========================================================================
7) cryptodbm.0.8: key-value database with encryption
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00096.html>
------------------------------------------------------------------------
** Didier Le Botlan announced:

Cryptodbm.0.8 is an ocaml library built on top of both the great
cryptokit package and the dbm library.

It offers a serverless key-value database with encryption.

Install with: opam install cryptodbm

API & presentation:
<http://cryptodbm.forge.ocamlcore.org/Cryptodbm.html>
      
========================================================================
8) Lablqt
Archive: <https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00102.html>
------------------------------------------------------------------------
** Kakadu announced:



More information about the caml-news-weekly mailing list