Here is the latest OCaml Weekly News, for the week of December 10 to 17, 2013.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00068.htmlDaniel 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.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00074.htmlGregory 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)" ...
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00078.htmlPierre-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).
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00085.htmlLukasz 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
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00088.htmlPeter 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.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00094.htmlSylvain 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
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00096.htmlDidier 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
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00102.htmlKakadu announced:
From today lablqt is available in opam. With it you can create user interfaces in declarative manner in QML and connect it with OCaml using `mocml` code generator and `lablqml` ocamlfind package. Qt 5.2 is required for compilation More information you can get at . There is mine opam repo where demo application is included. It is called QOCamlBrowser -- application similar to default ocamlbrowser. All comments will be appreciated. Kind regards, Dmitrii Kosarev aka Kakadu  http://kakadu.github.io/lablqt
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00105.htmlDaniel Bünzli announced:
I have written thin bindings to SDL 2 using ocaml-ctypes. The binding is finished but should be considered unstable: it was not thoroughly tested and may still change as it has not been *used* yet. The purpose of this unstable release is to: 1) Iron out the install procedure and test on a variety of platforms. 2) Get feedback about the design of the binding (see below). More precisely, apart from the eventual bugs, I'm interested in getting feedback in the following areas: * I used an 'a result = [ `Error | `Ok of 'a ] rather than an exception for functions that return error codes/null is error. I tend to lean on exceptionless designs but I'm still unsure whether it is a good idea that case. One of the problems is that SDL doesn't make a clear distinction (at the signature level *and* in the documentation) between programming errors (invalid_arg), exceptional errors (e.g. out of memory) and non-exceptional errors (e.g. could not access/setup a resource). * The signature/approach of certain binding functions may be disputable or may need change to achieve reasonable performance. * Testing the binding to the joystick/game controller/force feedback api, I have none of these things in my hands. I welcome discussions/ideas about these points and the general design of the binding on github's issue tracker (http://github.com/dbuenzli/tsdl) Note that the philosophy of the binding is to be "thin", that is a mostly type-safe(r), minimal, hopefully efficient, one-to-one binding. This means that I'm not interested in prettyfing the C API like OCamlSDL does. I expect tsdl code to look like C SDL code (including the inconsistent naming schemes) and the binding to be used by programmers to build higher-level, more OCaml friendly, abstractions. To install (only tested on osx and linux so far) you'll need at least SDL 2.0.1 installed on your system. Then: opam repo add erratique-u http://erratique.ch/software/opam/unreleased opam update && opam install tsdl On osx 10.8.5 with OCaml 4.01.0 there's a heisenbug I couldn't track so far (see  for more info). Use 4.00.1 instead for now but note that the binding takes a long time to compile (~8 min on my machine) with that. If you want to hack the sources: git clone http://github.com/dbuenzli/tsdl cd tsdl && ./build test.native && ./test.native The documentation of the binding is here: http://erratique.ch/software/tsdl/doc/Tsdl Best, Daniel  http://lists.ocaml.org/pipermail/ctypes/2013-December/000027.html P.S. If anyone wonders, the existing OCamlSDL is a very good binding to SDL 1.X, but SDL 2.0 is an entirely new, incompatible, API. Besides SDL 2.0 changed to a zlib license, tsdl is under BSD3, OCamlSDL is LGPL.
Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the recent posts from the ocamlcore planet blog at http://planet.ocaml.org/. Writing a Planner to solve a tricky programming optimization problem: http://rwmj.wordpress.com/2013/12/14/writing-a-planner-to-solve-a-tricky-programming-optimization-problem/ Farewell, Wojciech Meyer: http://gallium.inria.fr/blog/wojciech-meyer OASIS v0.4.0 release: https://forge.ocamlcore.org/forum/forum.php?forum_id=891 Release of OASIS 0.4.0: http://le-gall.net/sylvain+violaine/blog/index.php?post/2013/12/11/Release-of-OASIS-0.4.0
If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.
If you also wish to receive it every week by mail, you may subscribe online.