Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of November 01 to 08, 2011.

  1. PlasmaFS, PlasmaKV, and MapReduce, version 0.5
  2. Argot: 1.0 release
  3. Jump-to-definition and type-aware completion for Caml
  4. Is it possible to extend OCaml lexer rules via Camlp4?
  5. Other Caml News

PlasmaFS, PlasmaKV, and MapReduce, version 0.5

Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-11/msg00009.html

Gerd Stolpmann announced:
I've just released Plasma-0.5. Plasma consists now of three parts,
namely PlasmaFS, PlasmaKV, and Plasma Map/Reduce:

      * PlasmaFS is a distributed replicating filesystem. Unlike other
        such filesystems, it is transactional and exhibits transactions
        to the user. Also, it implements almost all of what is known as
        POSIX semantics, and it is mountable.
      * PlasmaKV is a key/value database on top of PlasmaFS. It is
        designed for ultra-high read workloads, and offers interesting
        properties borrowed from PlasmaFS (e.g. replication and ACID
        transactions).
      * Plasma Map/reduce implements a variant of the popular
        computation scheme.

The real major change in version 0.5 is the addition of PlasmaKV.
Because PlasmaFS offers a richer API than is normally available from a
filesystem, the implementation of this NoSQL db takes less than 2000
lines of code. Nevertheless, it has properties most other NoSQL db's
cannot fully implement, like complete isolation between readers and
writers (i.e. they do not lock each other out). A description of the
concept can be found here:

http://projects.camlcity.org/projects/dl/plasma-0.5/doc/html/Plasmakv_intro.html

The extremely simple API:

http://projects.camlcity.org/projects/dl/plasma-0.5/doc/html/Pkv_api.html

The other major change in version 0.5 is the implementation of parallel
commits in PlasmaFS. A test deployment showed that it is now possible to
get around 500 commits/second.

All pieces of software are bundled together in one download. The
project page with further links is

http://projects.camlcity.org/projects/plasma.html

There is now also a homepage at

http://plasma.camlcity.org

THIS IS NOW A BETA RELEASE! I'm searching for testers. Whoever has
access to a cluster please check Plasma out!

Plasma is installable via GODI for Ocaml 3.12.

For discussions on specifics of Plasma there is a separate mailing list:

https://godirepo.camlcity.org/mailman/listinfo/plasma-list
      

Argot: 1.0 release

Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-11/msg00010.html

Xavier Clerc announced:
This post announces the 1.0 release of the Argot project, whose goal
is to provide an enhanced HTML generator for ocamldoc, released under
the GPL v3.

Home page: http://argot.x9c.fr
Preview page (for search feature): 
http://argot.x9c.fr/distrib/argot-3.12-libref/index.html
Forge page: https://forge.ocamlcore.org/projects/argot/

Main changes since 1.0-beta:
  - new '-search' command-line switch to generate search information
    (available on HTML pages through the magnifying glass icon)
  - search by exact name
  - search by name using regular expression
  - search by type using isomorphisms (experimental)
  - new '-definitions' command-line switch to load variables from file
  - correct handling of embedded tables
  - more predefined licenses for the '@license' tag
  - some refactoring
      
Fabrice Le Fessant then said:
  By the way, Thomas is also working on a plugin for ocamldoc, with
incremental search. An example of what it generates (for the stdlib and
some of our internal libraries) is available here:

http://www.ocamlpro.com/doc/stdlib/index_modules.html

  It is not yet released, but we plan to do it in the next months, with
some other tools.
      
Anil Madhavapeddy then added:
Thomas also prototyped a searchable version for the CUFP Mirage tutorial:
e.g.: http://www.ocamlpro.com/mirage/xen/ ;

but the search view does need some optimisation with a large number of 
modules, as in the standard library.  The new version he's doing in HTML is 
far slicker and faster.

Citrix have a really useful JSON output to ocamldoc in the XAPI tree that is 
very handy for anyone else who wants to do something like this:
https://github.com/xen-org/xen-api/blob/master/ocaml/doc/odoc_json.ml
      
rixed asked and Thomas Gazagnaire replied:
> This looks very promising.
> Will the tool generate mere html files or is it intended for an ocaml
> web framework such as ocsigen ?

Currently, it generates only raw HTML files. The goal is to be able to browse 
it locally (it's a bit awkward to have to run a webserver to read 
documentation).

> Also, apparently one cannot search by type. It would be a nice feature
> to have.

The searching tools are quite limited currently, I'm just re-using standard 
JavaScript libraries for auto-completion. I had a quick look at Argot, and if 
I understand correctly, it is generating data and javascript code to enhance 
the search. So, I think it is possible integrate both tools nicely.

> Last thing, unrelated: from the search box one can see you have many
> modules extending the stdlib (the Ocp* modules). Why another stdlib
> extension instead of, say, contributing to batteries ?

That's true, we have developed internally some limited extensions to the 
standard library; that's because we didn't want to have external dependencies 
for our tools and because the amount of extensions was very small (so it was 
quicker to write the extensions than to modify an external library) However, 
we don't plan to release yet-an-other-standard-library, so I guess than we 
could later participate and switch to more widely-used standard library 
extensions.
      
Daniel Bünzli asked and Xavier Clerc replied:
> Regarding search by type, I wonder if people actually use this for
> useful reasons or if it's just out of curiosity or for the cool hack
> factor -- and sure it's cool. I mean there's not enough semantics in
> types to tell you what a function will do, and since we curry it is
> not always clear in which order we will argument.

To be clear, I implemented search by type in order to understand a bit
more the book of Roberto Di Cosmo about type isomorphisms. Whether it
can be a useful tool remains to be determined. The tool now exists,
let's see if there is a usage for it.

I do agree that there is often not enough semantics in OCaml types, but
please notice that the order of arguments and whether the function is
currified is not relevant. Indeed, doing type search up to isomorphisms
allows to get rid of these details, all of the following queries will
answer with "String.sub":
  - "int -> int -> string -> string"
  - "string -> (int * int) -> string"
  - "string * int *int -> string"
while the actual signature is "string -> int -> int -> string".
      
rixed asked and Fabrice Le Fessant replied:
> Last thing, unrelated: from the search box one can see you have many
> modules extending the stdlib (the Ocp* modules). Why another stdlib
> extension instead of, say, contributing to batteries ?

First, we don't have so many of them, we only put there what we needed
for our set of tools. Some of them are really close to the compiler, and
we might submit them for inclusion in the official distribution, so we
didn't want to add a dependency to Batteries or Core too early.

The other reason is that we haven't tried Batteries or Core enough yet,
we have constraints, and we must make sure that if we rely on the some
library, the library fit these constraints. For example, I know that
Core has not been tested on Windows, and I don't know for Batteries.
Also, we want to separate between "lang" and "system", i.e. modules that
can be implemented with the core language, and modules that have system
dependencies.

Finally, unlike other companies using OCaml, we want to provide support
on the language itself, which means the compilers, other dev tools, and
also basic libraries. So, at some point, we will have to contribute to
either Core or Batteries, or both, but before that, we need to think
more about our own idea of what a good standard library should be, to
choose the best candidate from our point of view.
      
Gerd Stolpmann also replied to the original announcement:
Excellent! I'll definitely use it.

Another idea for a feature: more options how classes and modules are
shown. For example, I once had the problem that I wanted an included
module also to be included in-place in the documentation (rather than by
reference/link). I modified the ocamldoc generator to get this effect,
and the result is here:

http://projects.camlcity.org/projects/dl/pxp-1.2.1/doc/manual/html/ref/Pxp_types.html

The grey box contains actually the included definitions. This is much
easier to understand for the casual reader. The feature is accompanied
by a link rewriter, so the ocamldoc-generated links point to the
including module rather the included module.

A similar problem occurs for inherited class types. Of course, one wants
to enable this on a case-by-case basis.

I blogged about this some years ago:
http://blog.camlcity.org/blog/pxp121.html

The generator (very specific to this case):
https://godirepo.camlcity.org/svn/lib-pxp/tags/pxp-1.2.1/tools/src/odoc/chtml.ml
      

Jump-to-definition and type-aware completion for Caml

Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-11/msg00038.html

Daniel Bünzli asked and Gabriel Scherer replied:
> But having been recently forced out of emacs into a proprietary IDE to
> be *able* to work on a project written in a
> programmingLanguageWithAbsurdlyLongNamingConventions, one thing I
> actually became very fond of is type aware autocompletion and the
> ability to browse from a symbol in my code directly to the page where
> its documented. The former may be complex to implement without
> compiler support but I'm sure the latter is not. My elisp skills are
> however too limited for me to implement that myself but I'd love to
> have that in ocaml's emacs mode.

There are various external projects/patches to do this kind of things:
- Jun Furuse's [Ocamlspotter] is a patch to the compiler to enrich
.annot files with where-defined information on symbols. It has some
emacs integration code.
- Peng Zang's Enhtop+ (an incremental update of Zeng Li's Enhtop
enhanced toplevel) provides enviroment lookup capacities in the
toplevel. He uses it to build [tuareg-plus], an emacs glue providing
context-aware completion (I'm not sure how good it works though, never
tried myself)

[Ocamlspotter] http://jun.furuse.info/hacks/ocamlspotter
[Enhtop+] http://www.cc.gatech.edu/~pengzang/enhtop+.html
[Enhtop] http://www.pps.jussieu.fr/~li/software/index.html#enhtop
[tuareg-plus] http://www.cc.gatech.edu/~pengzang/tuareg-plus.html

Beware that all those projects tend to be built as patches to the
ocaml distribution, which means difficult deployment (which means few
users, which means few maintenance, which means bitrot). I'm not
saying life is *easy* if you wish to use IDE tools for OCaml, only
that it is possible.

There are surely other alternatives I forgot about (please feel free
to add something) and related projects that are interesting as well
(eg. Jérémie Dimino 'utop' toplevel). You may also have a look at the
various attempts at integrating OCaml with Java IDEs (Oca'IDE, Ocaml
Development Tools, etc.). I'm various people are also developing new
exciting tools. For example, Ocamlpro has announced that it
could/would develop IDE tooling, for example; incidentally, they also
work on internal passes dumping techniques that might make development
and deployment of such tools easier in the future.
      

Is it possible to extend OCaml lexer rules via Camlp4?

Archive: https://sympa-roc.inria.fr/wws/arc/caml-list/2011-11/msg00014.html

Jun Furuse asked and Nicolas Pouillard replied:
> I want to have pcre regexp literals in the same syntax as Perl i.e.
> /hello\sworld\\n/. Currently what we do in OCaml is Pcre.regexp
> "hello\\sworld\\\\n", where the backslash char must be escaped in a
> OCaml string literal. This is lousy for scripting in OCaml.
> 
> To have the same or similar syntax as Perl, the lexer must be really
> modified. Currently I am using a modified CamlP4 where I can replace
> its lexer function, but it is an adhoc way, and I am seeking any
> healthier way without such a modification.

 As said earlier Camlp4's lexer is not extensible. One can change
the meaning of the token stream using the token filters but this
won't work in your case. The third option is to use quotations this
is really the adapted feature for this task. Of course the syntax
won't be as concise as /bla/...

Regarding OCaml lexing you may be interested in camllexer [1] which
is not intended to be extensible but is very small and selfcontained.
If you really want to hack your own lexical syntax I suggest you to fork
camllexer and change it for your purpose.

[1]: https://github.com/np/camllexer
      
Jérémie Dimino also suggested:
Have you look at camlp4 quotations ? Basically you can define a new
quotation named "foo" and in you code you can write:

  <:foo<...>>

The ... can be any string, except that it cannot contains >>.

Also you may be interested in the Mikmatch syntax extension:

  http://martin.jambon.free.fr/micmatch.html
      
Jun Furuse then concluded:
Unfortunately the conclusion seems to be currently there is no way to
change the lexer by pa_*.cmo modules.

Then, I stick to my patched p4 approach for now. With it I can use
$/regexp\n/i and $`find . -iname hoo` syntax, but for whom using the
vanilla p4, they can still use <:m<regexp\n/i>> and <:qx<find . -iname
hoo>> :

  https://bitbucket.org/camlspotter/orakuda/src/50d736f39428/test
      

Other Caml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the
recent posts from the ocamlcore planet blog at http://planet.ocamlcore.org/.

ocamlnat:
  https://forge.ocamlcore.org/projects/ocamlnat/

Argot 1.0:
  http://caml.inria.fr/cgi-bin/hump.cgi?contrib=754

Plasma 0.5:
  http://caml.inria.fr/cgi-bin/hump.cgi?contrib=733

After NoSQL there will be NoServer:
  http://blog.camlcity.org/blog/plasma5.html

Argot: 1.0:
  https://forge.ocamlcore.org/forum/forum.php?forum_id=813

OCaml, the ultimate refactoring tool:
  http://ocaml.janestcapital.com/?q=node/101

Disk space problem solved:
  https://forge.ocamlcore.org/forum/forum.php?forum_id=812
      

Old cwn

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.


Alan Schmitt