Hello
Here is the latest OCaml Weekly News, for the week of October 21 to 28, 2014.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00165.html
Sébastien Hinderer asked and David Allsopp replied:> OCaml 4.02.0 prints the following warning: > Warning 3: deprecated: String.create > > The code that triggers this warning looks like this: > > let buf = String.create size in > really_input ic buf 0 size; > > Is there a way to fix the code so that it does not trigger this warning > but still compiles also with older versions of Caml, up to 3.10? Yes - write your code to use Bytes (http://caml.inria.fr/pub/docs/manual-ocaml/libref/Bytes.html) and then add a requirement for findlib >= 1.5 which includes the "bytes" package (this is a dummy package for OCaml >= 4.02 and a compatibility layer for OCaml < 4.02). Alternatively, if for some very strange reason you're not happy to depend on findlib, you can borrow its compatibility layer directly (src/bytes/bytes.ml) and integrate that into your build system.Sylvain Pogodalla also replied:
You can pass the -w -3 option to the compiler to disable waring messages on deprecated features.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00175.html
Thomas Braibant announced:The next OUPS meetings will take place on the following dates: - the 29th of october (next week!), we will have a compiler hacking session at IRILL, starting at 7pm. More details are available here [1] - the 9th of december, we will have a "regular" OUPS meetup. The program will soon be available here [2]. If you would like to give a talk, feel free to send me an email! [1] http://www.meetup.com/ocaml-paris/events/215013812/ [2] http://www.meetup.com/ocaml-paris/events/215017872/
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00178.html
Jacques-Pascal Deplaix announced:I and Sylvain Le Gall just released OASIS 0.4.5. OASIS is a tool to help OCaml developers to integrate configure, build and install systems in their projects. It should help to create standard entry points in the source code build system, allowing external tools to analyse projects easily. Important changes: * Build and install annotation files. * Use builtin bin_annot and annot tags. * Tag .mly files on the same basis as .ml and .mli files (required by menhir). * Remove 'program' constraint from C-dependencies. Currently, when a library has C-sources and e.g. an executable depends on that library, then changing the C-sources and running '-build' does not yield a rebuild of the library. By adding these dependencies (rather removing the constraint), it seems to work fine. * Some bug fixes Features: * no_automatic_syntax (alpha): Disable the automatic inclusion of - syntax camlp4o for packages that matches the internal heuristic (if a dependency ends with a .syntax or is a well known syntax). * compiled_setup_ml (alpha): Fix a bug using multiple arguments to the configure script. Full blog post here: http://le-gall.net/sylvain+violaine/blog/index.php?post/2014/10/23/Release-of-OASIS-0.4.5 Download here: https://forge.ocamlcore.org/frs/?group_id=54&release_id=1109Jacques-Pascal Deplaix later added:
The new release is now available on opam.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00180.html
Continuing the thread from last week, John Whitington announced:Have cut a v0.1, now in OPAM "opam install exn-source". a) Now finds the stdlib automatically; b) Fixed to underline multiple-line errors; c) Compiles with -linkall so activated merely by linking.Gabriel Scherer later added:
exn-source produces an output using ANSI escape codes. Here is a text version (ansifilter --text): http://gallium.inria.fr/~scherer/tmp/tmp/exnsource-example.text and a HTML version http://gallium.inria.fr/~scherer/tmp/tmp/exnsource-example.html To (re)produce this output I ran the command OCAMLRUNPARAM="b" ./cpdf -debug foo.pdf from the the tag v1.7 of the repo https://github.com/johnwhitington/cpdf-source/ (after installing both camlpdf (from OPAM) and exnsource (from github)) with the following patch applied: diff --git a/Makefile b/Makefile index d706771..c4f9523 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ SOURCES = $(foreach x,$(MODS),$(x).ml $(x).mli) cpdfcommandrun.ml RESULT = cpdf -PACKS = camlpdf +PACKS = camlpdf exnsource OCAMLNCFLAGS = -g OCAMLBCFLAGS = -g diff --git a/cpdfcommandrun.ml b/cpdfcommandrun.ml index 2a43a43..bb0af72 100644 --- a/cpdfcommandrun.ml +++ b/cpdfcommandrun.ml @@ -1,2 +1,4 @@ +let _ = Exnsource.add_dir "" + let _ = Cpdfcommand.go ()
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00184.html
Peter Zotov announced:I'm glad to announce the release of ppx_deriving and several deriving plugins that I maintain. This release includes several breaking changes; however, the interface can now be considered stable and I do not expect it to change significantly. The OPAM packages will be available shortly. The two most important changes are: * The deriver names are now lowercase. I.e. you should replace all instances of [@@deriving Foo] with [@@deriving foo]. * ppx_deriving now integrates better with ocamlfind. Specifically, it does not automatically discover the deriver plugins based on their names; rather, it now expects you to explicitly require the corresponding plugin. In order to write code that uses [@@deriving yojson], it is now enough to add -package ppx_deriving_yojson to the ocamlfind ocamlc command line, or package(ppx_deriving_yojson) to the _tags file. This will also automatically include any runtime component that a deriving plugin may need. The package ppx_deriving.std depends on all deriver plugins that come with ppx_deriving itself. The changes were made in order to bring ppx_deriving closer to type_conv and ease migration. Some of the less important but interesting changes: * The [%derive.foo:] can now be shortened to [%foo:], given that deriving plugin foo is registered. For example, the following code will print a list of number pairs: print_endline ([%show: (int*float) list] pairs) * It is possible to combine several deriving plugins into a single executable, e.g. for cross-compiling: ocamlfind opt -predicates ppx_driver \ -package ppx_deriving_foo -package ppx_deriving_bar \ -package ppx_deriving.main -linkpkg -linkall \ -o ppx_driver Full changelogs: ppx_deriving 1.0 ---------------- * Make deriver names lowercase. * Remove Findlib+dynlink integration. All derivers must now be explicitly required. * Allow shortening [%derive.x:] to [%x:] when deriver x exists. * Make Ppx_deriving.core_type field optional to allow ignoring unsupported [%x:] shorthands. * Add support for [@@deriving foo { optional = true }] that does not error out if foo is missing, useful for optional dependencies. * Rename ~name and ~prefix of Ppx_deriving.attr and Ppx_deriving.Arg.payload to ~deriver. * Renamed Ppx_deriving.Arg.payload to get_attr. * Add Ppx_deriving.Arg.get_expr and get_flag. ppx_deriving_yojson 2.0 ----------------------- * Update to accomodate syntactic changes in _deriving_ 1.0. * Common helper functions have been extracted into ppx_deriving_yojson.runtime, reducing code size. * Add support for `[@@deriving to_yojson, of_yojson]` and `[%to_yojson:]`, `[%of_yojson:]` shortcuts. * Add support for `[@@deriving yojson { strict = false }]`. ppx_deriving_protobuf 2.0 ------------------------- * Update to accomodate syntactic changes in _deriving_ 1.0.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00188.html
Sylvain Le Gall announced:Here is the full blog post: https://forge.ocamlcore.org/forum/forum.php?forum_id=913 Sorry again for the problem Sylvain Le Gall
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00190.html
Louis Gesbert announced:We're very proud to announce the final release of OPAM 1.2.0 This is a big step after 1.1, with lots of new features and a huge effort put into improving the ease of use, output and error handling. Read the full announcement at http://opam.ocaml.org/blog/opam-1-2-0-release Or head straight to the install instructions at http://opam.ocaml.org/doc/Install.html (but know that your existing 1.1 ~/.opam will be updated on first run) With big thanks to all the beta-testers who took the time to report issues. Louis Gesbert, OCamlPro, on behalf of the OPAM team.Louis Gesbert said and Mehdi Dogguy announced:
> Indeed, 1.2.0-rc4 has been promoted to 1.2.0 ; the sources are > identical, and no upgrade is required if you were already on RC4. Ok. Thanks for the confirmation. Then, I'm happy to announce that (for once :-P) Debian has Opam's latest release in Sid, will migrate in a few days to testing... and will be part of the forthcoming Jessie release.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00194.html
Michael Grünewald announced:The Gasoline project aims at implementing a Unix-ish application development framework for OCaml. The framework will provide application templates factoring application components bootstrapping, configuration analyse and offering homogeneous diagnostic facilities. It can be installed with opam, see below. It is written by Michael Grünewald and is distributed under the CeCILL-B license agreement. Users of Gasoline should be enabled to: - Rapidly develop applications by using application patterns such as “Unix filter”, “tabular data processor” or “compiler”. - Write large software suites whose elements offer homogeneous interfaces. - Easily pass configuration parameters to an application - Use standardised diagnostic facilities supporting internationalisation. - Cleanly distinguish between application components and lower-level software engineering artifacts. - Easily bootstrap and shutdown applications consisting of many modules. - Use common file formats such as CSV or JSON in their applications. Github: https://github.com/michipili/gasoline Wiki: https://github.com/michipili/gasoline/wiki OCamldoc reference: http://michipili.github.io/gasoline/reference/index.html 0 EXAMPLES There is three examples of applications using Gasoline in the example tree. These are: * punishment, a simple program claiming “It shall not talk in class” and illustrating the use of configuration parameters and configuration sources. * wordcount, an over-engineered version of wc illustrating the use of application components. * wordgen, a random name generator (as found in Angband for instance) also illustrating the use of application components. 1 WHAT ARE APPLICATION PATTERNS Developing a Unix filter — for instance — should require little more than writing a function parameter -> in_channel -> out_channel -> unit where parameter is a fictional type representing filter parameters. A goal of Gasoline is to define application templates taking care of all the house-keeping required by the bootstrapping of an application. This should increase development speed of applications and ease the preparation of large software suite presenting a consistent interface. Some application patterns are scheduled for v0.3, see the issue tracker. 2 WHAT THE LIBRARY ALREADY DO It implements a poweful configuration parameter framework, see the wiki page Configuration. It implements a generic diagnostic facility, allowing fine-grained control of application diagnostics (like what xdvi does), see the wiki page GenericDiagnostic. It implements basic software component management, see the wiki page Component. 3 HOW TO INSTALL There is detailed build instructions in the README. There is also an experimental OPAM package in my opam-repository clone, it works on FreeBSD, Debian and MacPorts. https://github.com/michipili/opam-repository/tree/port/gasoline 4 CLOSINGS I am looking forward hearing your comments and suggestions about Gasoline. This is still experimental software and many areas should be refactored.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00200.html
Jan Rehders announced:To get familiar with ppx filters I made a simple filter to produce strings by interpolation like [%str “value of foobar is $(foobar)”]. It’s loosely based on Peter Zotov's getenv example but demonstrates a few more things like fixing up source locations and emitting compilation errors. Find it at https://github.com/sheijk/ppx_string_interpolate Some open issues: = Packaging = opam/ocamlfind packaging. There are META and opam files plus ocamlfind based install/uninstall steps. I think I got this mostly right but currently it does not work. The problem is that after installation using opam ocamlfind won’t find my package. I followed the steps from https://opam.ocaml.org/doc/Packaging.html. After installation I see the META and ppx_string.native files in ~/.opam/4.02.1/lib/ppx_string_interpolate/.. but ‘ocamlfind list’ won’t contain ppx_string_interpolate. I’m not sure how to investigate this as I can’t find too much documentation about the internals of ocamlfind/opam (like which files does it expect, where should they be, etc.). I tried to check with ppx_tools and sedlex to see what I’m missing but don’t see anything, either. So any hints what might be the issue here would also be appreciated. = Using \ instead of $ = Using Swift style \(foo) instead of $(foo) would be nice but will produce warnings from the lexer which I can't suppress w/o suppressing all warnings about invalid escape sequences. Also this requires doing this from the makefile so every user would have to do it. Is there some API I’ve missed to suppress specific warnings on the code inside [%str ..] from ppx filters? Any feedback is appreciated (and thanks to the people in #ocaml who already provided some very valuable suggestions!).Alain Frisch then suggested:
You might want to use the new syntax for string literals: {| .... |} or: {id| .... |id} (for an arbitrary id). Contrary to regular string literals, OCaml doesn't apply any lexing convention to the string contents: what you have in the Parsetree is exactly the sequence of bytes from the source file. This allows you to use you own conventions: \(foo) Also, you can map in an exact way between from an index in the string to a location in the source code (in a regular string, you cannot distinguish \065 from A in the Parsetree, which makes this exact mapping impossible). Combined with an extension node, this would give: [%str{| blabla \(x) blabla |}]Jan Rehders then replied:
Alain: yes, for the new string literals this issue does not exist (and they are already supported). But I'd like to keep support for regular strings, too. I guess I could also simply expand something like {istr|...|istr} but I think transforming anything that isn't in "my" annotations is a bad idea.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-10/msg00203.html
David Allsopp asked and Daniel Bünzli replied:> Given: > > let f fmt = Printf.printf fmt;; > > [f] will have type ('a, out_channel, unit, unit) format4 > > Given: > > let f fmt = Printf.ksprintf print_string fmt > > [f] will have type ('a, unit, string, unit) format4 > > They do exactly the same thing (at least in terms of side effects) - what's > the fundamental reason for having to suffer their having incompatible format > types? It becomes excessively irritating when trying to switch between > different formatters (as a given format string cannot be used in a way in > which it appears to have more than one type, obviously), but I'm sure > there's a reason for its being that way! You may be interested in reading this: http://gallium.inria.fr/blog/format6/ Daniel P.S. If you are using formatters the problem is less acute. Nowadays you can simply define formatters for each of your types with: pp : Format.formatter -> t -> unit and a to_string function is one `Format.asprintf "%a" pp` away.
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/. Visualising an asynchronous monad: http://roscidus.com/blog/blog/2014/10/27/visualising-an-asynchronous-monad/ Coq 8.4pl5 is out: http://coq.inria.fr/coq-84pl5-is-out Interviewing At Jane Street: https://blogs.janestreet.com/interviewing-at-jane-street/ Recent reboots explained: the forge has been compromised: https://forge.ocamlcore.org/forum/forum.php?forum_id=913 OPAM 1.2.0 Released: http://ocaml.org/ Release of OASIS 0.4.5: http://le-gall.net/sylvain+violaine/blog/index.php?post/2014/10/23/Release-of-OASIS-0.4.5
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.