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

Alan Schmitt alan.schmitt at polytechnique.org
Tue May 1 00:21:55 PDT 2007


Hello,

Here is the latest Caml Weekly News, for the week of April 24 to May  
01, 2007.

1) OCaml and the web
2) new+old Camlp4
3) ICFP Programming Contest 2007
4) JOB: hack OCaml at a mobile startup
5) Function application implementation
6) camlp4s 4.01
7) New release of moca
8) mboxlib reloaded ;-)
9) Great article by Yaron Minsky

========================================================================
1) OCaml and the web
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
aa5a99a73e28e331/e9ad46b9c9a3d4bb#e9ad46b9c9a3d4bb>
------------------------------------------------------------------------
** konrad asked:

I already read something about ocaml and web programming. Do some of  
you have
experiences with:

- ocaml as scripting language as cgi as an apache module
- any other possibility to use ocaml for web programming (a.e. an  
extendable
ocaml webserver)

Thanks for any hints or links to tutorials or further information.
			
** Jason Ganetsky suggested:

ocaml as scripting language as cgi as an apache module:
<http://merjis.com/developers/mod_caml>
extensible ocaml web server: <http://www.ocsigen.org/>
			
** Zheng Li also answered:

COCAN have collected links to previous discussion threads [1] on this  
topic as
well as some preliminary comparison [2].

[1] <http://wiki.cocan.org/web_programming_with_ocaml>
[2] <http://wiki.cocan.org/comparisons>
			
** David MENTRE added:

Another table with OCaml web framework comparison:
<https://demexp.org/dokuwiki/doku.php? 
id=en:web_client_development_framework#comparison_of_ocaml_frameworks>
			
** konrad then asked and David MENTRE answered:

 > Did somebody of you already experience "web-programming" with ocaml?

Yes with WDialog. I would not recommend this framework (see below).
 > Are there webpages that are created with an  ocaml backend?

<http://www.linux-france.org/cgi-bin/demexpweb.cgi>
 > Is it convenient and flexible? I would like to try that to gain  
all to
 > benefits from ocaml even for the web programming.

This question is closely tied to the framework itself. Regarding
WDialog, I found the description of web pages in XML format not very
satisfying, because a lot of things were put in the XML description
which was not very convenient (e.g. to handle translation of pages).
However, the programming of the OCaml part is always a pleasure. :-)
			
========================================================================
2) new+old Camlp4
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
f346e0326eba655f/4b8a3487f86199dc#4b8a3487f86199dc>
------------------------------------------------------------------------
** Martin Jambon said and Daniel de Rauglaudre answered:

 > The current situation with camlp4 3.10-beta is terrible. Not because
 > the new camlp4 is not good or anything, but because it is not  
compatible
 > with the old one and yet replaces it.

Alternative solution : download my version of Camlp4, named "camlp4s" :
     <http://pauillac.inria.fr/~ddr/camlp4s/>
This is Camlp4 before its inclusion into OCaml some years ago, and
upgraded to be (almost) compatible to the most recent versions of
Camlp4, except the forthcoming one 3.10.

Most important changes :

   One only source which can be used for several versions of OCaml. Just
   need to be recompiled. Can be used for ocaml versions from 3.08.1 to
   3.10. (If you use a more older version, I can add it.)

   The lexer Plexer has been rewritten. It uses a new syntax  
pa_lexer.cmo
   allowing to make parser of streams of characters with a shorter  
syntax.

   Experimented new directive "#pragma" allowing to evaluate expressions
   at compile time (= camlp4 time). Useful, for example, to experiment
   syntax extensions with the EXTEND statement without having to put
   it in another file.

   Started an experiment of a new pretty printing system, the old one
   of Camlp4 not being satisfactory, nor Format which has sometimes
   problems. The library is named Sformat, and is very simple.

But notice that this module Sformat is not yet used for camlp4s pretty
print, the old system remaining for the moment. I experimented it
separatedly and it seems to work. Interesting future feature : you
will be able to decide, by symmetry, to skip all lines in a pattern
matching between the pattern and the expression if one case need a
newline. Same thing in a "if then else" if the "then" case and the
"else" case are similar ("similarity" is tested with the library
"mldiff").

Its distribution being independant from OCaml distribution, new releases
can be done at any time.
			
** Xavier Leroy also answered:

 > I'd therefore strongly suggest that INRIA plan more carefully how to
 > make the next release.  From my point of view, the best way would be
 > to provide sufficient documentation in advance to allow Camlp4
 > developers to rewrite their macros in time.

I agree with the need for documentation, but not with the timing you
propose.  Release 3.10.0 has been delayed quite a bit already, and
1- there is no reason to make users who do not depend on Camlp4 wait  
longer
    for 3.10;
2- having the new Camlp4 officially released as part of 3.10.0 can only
    facilitate the porting of Camlp4 macros and extensions.
More generally, we are painfully aware that the transition from 3.09
to 3.10 is a minor upgrade for users who do not depend on Camlp4, but
a major change for Camlp4 users.  We plan to maintain 3.09 (by making
bug-fix releases) longer than usual so that users who are stuck with
the old Camlp4 can stay with 3.09 for a while.  Nobody is forced to
upgrade to 3.10 immediately.

Releasing both old and new Camlp4 as part of 3.10 is out of the
question, however.  That would only delay the inevitable and would
waste a lot of our time to make such a release.  The priorities are
1- get 3.10.0 out of the door, and 2- of course, provide more
documentation on the new Camlp4.
			
========================================================================
3) ICFP Programming Contest 2007
Archive: <http://caml.inria.fr/pub/ml-archives/caml-list/2007/04/ 
ed8a9acc747b36cd4bde2c49f503ef93.en.html>
------------------------------------------------------------------------
** Johan Jeuring announced:

Want to show off your programming skills? Your favorite programming
language?
Your best programming tools?

Join the ICFP Programming Contest 2007! The 10th ICFP Programming
Contest
celebrates a decade of contests. This is one of the world's most
advanced and prestiguous programming contest you can enter. For free!

Book July 20 - 23, 2007. Check out <http://www.icfpcontest.org/>.
			
========================================================================
4) JOB: hack OCaml at a mobile startup
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
d47e60b73c9bde3f/d0673ed5782d47a2#d0673ed5782d47a2>
------------------------------------------------------------------------
** Jake Donham announced:

Skydeck is a startup developing software and services at the
intersection of mobile phones, Internet telephony, and the web. We are
looking for great programmers to join us. Our office is located in
downtown San Mateo, CA, just a short walk to Caltrain and near plenty of
parking and lunch options.

To us a great programmer is someone who:

   * Gets things done.
   * Can debug effectively.
   * Knows how to remove complexity.
   * Has tried many different ways of programming.
   * Thinks programming is about the most fun thing out there.
   * Can express himself or herself clearly in speech and writing.
   * Has enough of an ego to dive into difficult projects.
   * Can set aside ego to work with others.
   * Is always striving to improve.

Some reasons you might like working at Skydeck:

   * We are small enough that you will have a big impact on what the
     company becomes, both technically and culturally.

   * We think the best way to get software out the door is with a small
     number of the best people that we can find.

   * We use the sharpest tools available, and build our own when needed.

   * Our products are going to be used by a lot of people and will  
change
     the mobile phone business for the better.

We program in OCaml when we can and C++ and Java when we must, on Linux,
Symbian, and Windows Mobile, but we require no specific experience.

Write to us at ocamljobs at skydeck.com. To get our attention, tell us what
you think is broken about the mobile phone market in the US today.
			
========================================================================
5) Function application implementation
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
17c91c62a5bd21c3/428e63198ac88971#428e63198ac88971>
------------------------------------------------------------------------
** skaller said and Xavier Leroy added:

 >     It knows the type of the function expression, and that is all
 >     that is required. Incidentally Ocaml evaluates right to left. So
 >             f x y z

 >     will be roughly:

 >             push (eval z)
 >             push (eval y)
 >             push (eval x)
 >             push (eval f)
 >             apply
 >             apply
 >             apply

 > But that doesn't explain how does each apply know what to do,  
either to
 > build a new closure (in the case above, the first two applies) or to
 > actually call the code (the third apply).


The generated abstract machine code is more like:
              push (eval z)
              push (eval y)
              push (eval x)
              push (eval f)
              apply 3        (*  number of arguments provided *)
"apply" doesn't do anything clever, it just enters the code of the
called function f.  It's the code of f that determines what to do
with the arguments provided on the stack.

More details can be found in one of my talks:
<http://gallium.inria.fr/~xleroy/talks/zam-kazam05.pdf>
			
========================================================================
6) camlp4s 4.01
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
c1c730a32ebe451a/c3f79409025fad43#c3f79409025fad43>
------------------------------------------------------------------------
** Daniel de Rauglaudre announced:

I just made a new release of camlp4s 4.01 to accept compilation with
current (CVS) ocaml version (3.11).

Camlp4s is the classical camlp4, developped and released independantly
from ocaml, with specific developpments. It is compatible with ocaml
from versions 3.08.1 to 3.11.

Camlp4s is your solution if you don't want to upgrade your programs
to the new incompatible version of camlp4 distributed with ocaml.

Home page :
     <http://pauillac.inria.fr/~ddr/camlp4s/>
			
========================================================================
7) New release of moca
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
946c5cd491a9e77e/a553b43e0e2b5337#a553b43e0e2b5337>
------------------------------------------------------------------------
** Pierre Weis announced:

              Relational types in Caml

I am pleased to announce the 0.3.0 version of Moca, a general  
construction
functions generator for relational types in Objective Caml.

In short:
=========
   Moca allows the high-level definition and automatic management of
complex invariants for data types; Moca also supports the automatic  
generation
of maximally shared values, independantly or in conjunction with the
declared invariants.

Moca's home page is <http://moca.inria.fr/>
Moca's source files can be found at
        <ftp://ftp.inria.fr/INRIA/caml-light/bazar-ocaml/moca-0.3.0.tgz>

Moca is developped by Pierre Weis and Frédéric Blanqui.

In long:
========
   A relational type is a concrete type that declares invariants or  
relations
that are verified by its constructors. For each relational type  
definition,
Moca compiles a set of Caml construction functions that implements the
declared relations.

Moca supports two kinds of relations:
- algebraic relations (such as associativity or commutativity of a  
binary
   constructor),
- general rewrite rules that map some pattern of constructors and  
variables to
   some arbitrary user's define expression.

Algebraic relations are primitive, so that Moca ensures the  
correctness of
their treatment. By contrast, the general rewrite rules are under the
programmer's responsability, so that the desired properties must be  
verified
by a programmer's proof before compilation (including for completeness,
termination, and confluence of the resulting term rewriting system).

What's new in this release ?
============================
* mocac now compiles and installs under Windows + Cygwin,
* polymorphic data type definitions are fully supported,
* documentation has been completed,
* a paper has been published at ESOP'07: On the implementation of  
construction
   functions for non-free concrete data types.
   <http://hal.inria.fr/docs/00/09/51/10/PS/main.ps>
* keywords ``inverse'' and ``opposite'' have been made synonymous,
* addition of new algebraic invariants:
   - absorbing has been distinguished from absorbent,
   - unary distributive has been generalized with two operators.
* sharing has been generalized to polymorphic data type.
* non linear patterns are now accepted in user's defined rules.

An example
==========
The Moca compiler (named mocac) takes as input a file with  
extension .mlm that
contains the definition of a relational type (a type with ``private''
constructors, each constructor possibly decorated with a set of  
invariants or
algebraic relations).

For instance, consider peano.mlm, that defines the type peano with a  
binary
constructor Plus that is associative, treats the nullary constructor  
Zero as
its neutral element, and such that the rewrite rule Plus (Succ n, p) - 
 > Succ
(Plus (n, p)) should be used whenever an instance of its left hand  
side appears
in a peano value:

      type peano = private
         | Zero
         | Succ of peano
         | Plus of peano * peano
         begin
           associative
           neutral (Zero)
           rule Plus (Succ n, p) -> Succ (Plus (n, p))
         end;;

 >From this relational type definition, mocac will generate a regular  
Objective

Caml data type implementation, as a usual two files module.
 >From peano.mlm, mocac produces the following peano.mli interface file:

      type peano = private
         | Zero
         | Succ of peano
         | Plus of peano * peano
      val plus : peano * peano -> peano
      val zero : peano
      val succ : peano -> peano
mocac also writes the following peano.ml file that implements this  
interface:

      type peano =
        | Zero
        | Succ of peano
        | Plus of peano * peano

      let rec plus z =
        match z with
        | Succ n, p -> succ (plus (n, p))
        | Zero, y -> y
        | x, Zero -> x
        | Plus (x, y), z -> plus (x, plus (y, z))
        | x, y -> insert_in_plus x y
      and insert_in_plus x u =
        match x, u with
        | _ -> Plus (x, u)
      and zero = Zero
      and succ x1 = Succ x1

To prove these construction functions to be correct, you would prove  
that
   - no Plus (Zero, x) nor Plus (x, Zero) can be a value in type peano,
   - for any x, y, z in peano. plus (plus (x, y), z) = plus (x, plus  
(y, z))
   - etc
   Hopefully, this is useless if mocac is correct: the construction  
functions
   respect all the declared invariants and relations.

To prove these construction functions to be incorrect, you would have to
   - find an example that violates the relations.
Hopefully, this is not possible (or please, report it!)

And, if you needed maximum sharing for peano values, you just have to  
compile
peano.mlm with the "--sharing" option of the mocac compiler:

$ mocac --sharing peano.mlm

would do the trick !

Conclusion:
===========
Moca is still evolving and a lot of proofs has still to be done about  
the
compiler and its algorithms.

Anyhow, we think Moca to be already usable and worth to give it a try.
Don't hesitate to send your constructive remarks and contributions !

Pierre Weis & Frédéric Blanqui.
			
========================================================================
8) mboxlib reloaded ;-)
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
714d9262a37c2934/b63f7728ec719d81#b63f7728ec719d81>
------------------------------------------------------------------------
** Oliver Bandel announced:

after two years of doing nothing on it,
I today found my mboxlib, I started to
write in 2005.

I have put the mli-file on the web and
maybe the library itself will follow
during the next time.

Any feedback, questions and suggestions are welcome.

   <http://me.in-berlin.de/~first/software/libraries/mboxlib/>
			
** Richard Jones then said:

The source for COCANWIKI[1] contains extensive support for threading
of mail messages, based on JWZ's algorithm:
<http://www.jwz.org/doc/threading.html>

You are of course welcome to copy this.  If there are any license
issues let me know & I can fix them.

I'd also like to point you to another useful JWZ doc:

<http://www.jwz.org/doc/mailsum.html>

Rich.

[1] <http://sandbox.merjis.com/>
			
========================================================================
9) Great article by Yaron Minsky
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
c7c384de99872db2/b5cc0cca5630bfa3#b5cc0cca5630bfa3>
------------------------------------------------------------------------
** Erik de Castro Lopo said:

I just thought I try to the the first to point out the great article
by Yaron Minsky in The Monad Reader:

     <http://www.haskell.org/sitewiki/images/0/03/TMR-Issue7.pdf>

Congratulations Yaron, its a great article to pass on to management
types.
			
========================================================================
Using folding to read the cwn in vim 6+
------------------------------------------------------------------------
Here is a quick trick to help you read this CWN if you are viewing it  
using
vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'<1':1
zM
If you know of a better way, please let me know.

========================================================================
Old cwn
------------------------------------------------------------------------

If you happen to miss a CWN, you can send me a message
(alan.schmitt at polytechnique.org) and I'll mail it to you, or go take  
a look at
the archive (<http://alan.petitepomme.net/cwn/>) or the RSS feed of the
archives (<http://alan.petitepomme.net/cwn/cwn.rss>). If you also wish
to receive it every week by mail, you may subscribe online at
<http://lists.idyll.org/listinfo/caml-news-weekly/> .

========================================================================

-- 
Alan Schmitt <http://alan.petitepomme.net/>

The hacker: someone who figured things out and made something cool  
happen.
  .O.
  ..O
  OOO


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: =?ISO-8859-1?Q?Questa_=E8_un_messaggio_firmato_elettronicamente?=
Url : http://lists.idyll.org/pipermail/caml-news-weekly/attachments/20070501/2d146c50/attachment.pgp 


More information about the caml-news-weekly mailing list