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

Alan Schmitt alan.schmitt at polytechnique.org
Tue May 15 01:18:02 PDT 2007


Hello,

Here is the latest Caml Weekly News, for the week of May 08 to 15, 2007.

1) offre d'emploi p2p/ocaml a l'INRIA
2) labltk for tk 8.4 BETA release
3) Felix 1.1.3 released
4) camlp4 and streams
5) ODT: a *new* OCaml IDE integrated into Eclipse
6) Polymorphic variant difference...

========================================================================
1) offre d'emploi p2p/ocaml a l'INRIA
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
1d19af765f2e0e7d/980d4954b3c61487#980d4954b3c61487>
------------------------------------------------------------------------
** Fabrice Le Fessant announced:

   Le projet ASAP cherche a recruter un jeune ingenieur pour un contrat
d'un an a l'INRIA-Futurs Saclay (Parc Club Universite, Orsay, RER Le
Guichet depuis Paris) pour travailler sur le prototype d'un logiciel
pair-a-pair en ocaml, Peerple (<http://www.peerple.net/>). C'est assez
urgent, les candidatures doivent maintenant se faire par email a mon
attention (fabrice.le_fess... at inria.fr), avant le 18 mai 2007 (fin de
semaine prochaine), le site web etant probablement clos pour le depot
de candidatures.

   La fiche detaillee de l'offre:

<http://www.inria.fr/futurs/emploi-et-formation/ingenieurs-jeunes- 
diplomes>

puis:

"Peerple, logiciel pair-à-pair d'hébergement de données"
			
========================================================================
2) labltk for tk 8.4 BETA release
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
4c644037991c6fab/7f13820d2ae933dd#7f13820d2ae933dd>
------------------------------------------------------------------------
** Jeffrey Loren Shaw announced:

I've updated labltk to use some new widgets and commands that are  
available
in Tk 8.4.

DIRECTIONS:
get the ocaml 3.10 beta release
extract the ocaml beta archive
replace otherlibs/labltk with the one from the following link
<http://www.msu.edu/~shawjef3/labltk-8.4-BETA1.zip>

configure, make world, make install

This is a BETA release, meaning that I believe I've implemented all  
the new
features, but I haven't tested them much.

Here are my additions to the changelog:

2007-05-11 (*BETA release from shawj... at msu.edu*)
----------
*labltk now requires Tk 8.4
*added spinbox widget
*added TkConsole module
*added labelframe widget
*added panedwindow widget
*added functions tk_textCopy, tk_textCut, tk_text_Paste to the text  
widget
*Removed CamlTk
*Removed tkanim (depended on Camltk)
*Removed Frx (Depended on Camltk)
*Removed examples_camltk (Depended on Camltk)

Please note that this is an unofficial release. I'm not affiliated  
with the
ocaml development team.
			
** David Teller then said:

That's a very good initiative.
In my mind, a few other things are missing in LablTk.

* Ease of installation.

At the moment, beginners who wish to use LablTk under Windows (or who
are pressed to do this by, say, their teacher) must first find and
install the correct version by inferring the location of the installer
from an erroneous link hidden in the fine print of the documentation of
LablTk [1].

As Tk is so important, i'm not sure why Tk is not bundled with OCaml's
Windows version. I suggest either bundling it or at least providing an
(up-to-date) link from OCaml's official download page [2].

* Documentation

At the moment, LablTk has virtually no documentation. The page in the
manual is barely an overview and suggests reading the documentation of
Tcl/Tl. Which is all fine and good, except that it doesn't help with
types, I can't for the life of me remember how I found out that type
~~  color ~~ is actually a polymorphic variant ~~ `Color of string ~~
and beginners who learn OCaml as their first or second programming
language will never manage that much.

I suggest including a LablTk tutorial, perhaps inspired of [3] and
actually ocamldocumenting the .mli .

* Other libraries

Ok, I might be asking a lot, but I personally consider that Graphics is
half-useless without CamlImages. I also consider that LablGl is a good
way to demonstrate the power of OCaml to students and perhaps to bring
them to something like game programming in OCaml. It requires CamlImages
for textures. The list could continue with LablGtk and plenty of others
but these two would be my personal priority.

Consequently, in my mind, both should be easy to install at the same
time as OCaml, which is not the case at the moment. Again, under Linux,
that's not much of a problem. Under Windows (and perhaps Mac OS X), it
is very much so.

I don't suggest providing a package manager under Windows and I do know
about GODI but I also know that students will never be bothered to
install GODI. What I do suggest is just either adding inside OCaml's
Windows installer the option to add "extension libraries", with a short
description of what each extension does, or providing links to binary
installers from OCaml's download page.

What do you think ?

Cheers,
David

[1] <http://caml.inria.fr/pub/docs/manual-ocaml/manual042.html>
[2] <http://caml.inria.fr/ocaml/release.en.html>
[3] <http://www.cs.uiuc.edu/class/sp07/cs421/resources/labltk/>
			
** Jeffrey Loren Shaw answered:

* ease of installation

<http://downloads.activestate.com/ActiveTcl/Windows/8.3.5/>

or for the beta labltk...

<http://downloads.activestate.com/ActiveTcl/Windows/8.4.14/>

Yup that link should be updated. I don't think it should be bundled with
ocaml, however. The end-user might already have it installed, or  
might not
need it. But this is a decision for the ocaml devs.

* Documentation

You're right, it's not very good. I used the ocamlbrowser extensively to
learn how to use labltk. It took me a lot of experimenting, and I'm  
still
terrible at getting widgets laid out the way I want.

I'm not sure how to do the documentation in an automated way without
changing the grammar for widgets.src to allow ocamldoc comments. That's
beyond my abilities, but I suppose it's a worthy project for someone.  
On the
other hand, widgets.src is already very cluttered.

* Other libraries

I don't know anything about these, but again these are questions for the
ocaml devs.

Anyway, my focus right now is getting this beta version of labltk  
working
correctly... there's a lot of functions to test.

Now here's an idea...

Instead of documenting labltk, which is difficult for the beginner ocaml
programmer anyway, make a wrapper to make it more ocaml-y. I'm not  
sure if
this would be easy or possible, but coercing labltk into one style of
programming (preferably functional) could go a long way towards  
making it
easier to learn for the beginner. Also the wrapper would potentially be
easier to document. As I recall, the most difficult aspects of labltk  
are
those that are imperative, eg:

event functions are unit -> unit, (maybe this can't be avoided)
pack is difficult to deal with,
the need to use optionmenu and Textvariable.handle together is not  
obvious

Another huge but useful project would be a type-safe parser for the  
outputs
given by the Widget.configure_get functions.

Now back to testing.
			
** Later on, Jeffrey Loren Shaw announced:

<http://www.msu.edu/~shawjef3/labltk-8.4-BETA2.zip>

There's nothing to add to the changelog; this simply contains bug  
fixes. The
bugs were things I added incorrectly to widgets.src.

I deleted labltk-8.4-BETA1.zip so it is no longer available.
			
========================================================================
3) Felix 1.1.3 released
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
375b00ab380569c2/b1830ccda8a9a076#b1830ccda8a9a076>
------------------------------------------------------------------------
** John Skaller annouced:

Felix 1.1.3 has been released and can be obtained from
         <http://felix.sourceforge.net/flx_1.1.3_rc4_src.tgz>

(it's release candidate 4, but that's final in the 1.1.3).
It should build on all Unix systems, OSX, Cygwin, Win32,
and Win64 (using VS2005=VC7 or VS2007=VC8 compilers).
You will need Python, Ocaml, and either g++ or MSVC++ installed.
Please join mailing list for help building on Windows platforms.

Felix is an advanced language in the Algol/ML family,
with technology and ideas stolen from Ocaml and Haskell.
It generates ISO C++ code, and provides facilities for
easy binding to C and C++ using a NFI (Native interface)
generally not requiring any external glue logic.
It also features high performance user space cooperative
threading.

Licence: FFAU (roughly BSD).

Roughly it is designed for C++ programmers who can't afford
to throw out legacy C/C++ libraries or frameworks,
Ocaml/ML/Haskell programmers with the same problem,
applications requiring very high performance,
or researchers who want to implement production variants
of research ideas in a open code base.

This release was a long time coming because it adds a major
new feature -- Haskell style typeclasses. This facility
is equivalent to C++ template specialisation, but done right.
Second order support is 'just enough' to provide a Monad
typeclass.

In addition, this release supports first order axioms, reductions,
and lemmas. Reductions are user defined term rewriting rules.
Lemmas are propositions which can be proven from axioms.
These assertions can be written in typeclasses to provide
formal specification of some semantics.

Apart from automated checking of axioms by use cases, Felix now
emits Why code representing the axioms, and makes any
lemmas goals. The generated files can be submitted to
a theorem prover via Jean-Christophe Filliâtre Why program

         <http://why.lri.fr/>

or directly to Ergo. This system is of course work in
progress, but it does verify at least one simple lemma :)
			
========================================================================
4) camlp4 and streams
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
a1a46639c13c92b7/0f89c6358069a60d#0f89c6358069a60d>
------------------------------------------------------------------------
** Isaac Freeman asked and Nicolas Pouillard answered:

 > I am having some problems using streams in my camlp4 extentions.  
The code:

 > EXTEND
 >   expr: LEVEL "expr1"
 >     [[ "yield"; e1 = expr LEVEL "simple";
 >        "continue"; e2 = expr LEVEL "simple" ->
 >           <:expr< [< $e1$; $e2$ >] >> ]];
 > END;;

 > produces the error:

 > isaac at lappy:~/stuff/ocaml$ ocamlc -pp "camlp4o pa_extend.cmo
 > q_MLast.cmo" -I +camlp4 -c gen-syntax.ml
 > File "gen-syntax.ml", line 8, characters 18-20:
 > While expanding quotation "expr":
 > Parse error: illegal begin of expression
 > Uncaught exception: Pcaml.Qerror("expr", 1, _)
 > Preprocessor error

 > However, when I change the stream into a list, it works fine, so I'm
 > sure there is just some technicality in using streams here that I'm
 > not accounting for properly. Any ideas?


You are hitting a limitation of the old camlp4 implementation. The
thing is that the quotation expander <:expr<...>> provided by
q_MLast.cmo is somewhat limited to the revised syntax.
BTW in revised streams syntax is: [: ... :] (instead of [< ... >]) and
elements starts with a backquote instead of a single quote.

Indeed the stream syntax is provided as a syntactic sugar over regular
OCaml code using the Stream module from the standard library.

However the new Camlp4 implementation provided in 3.10 lift that
shortcoming by giving a full reflection system. So if you want to use
the original syntax everywhere you can use camlp4of that provided
quotation (<:expr<...>>, patt, ctyp...) in the original syntax
including syntactic sugars.

Here is a 3.10 valid extension:

$ cat ext.ml
open Camlp4.PreCast;;
open Syntax;;
EXTEND Gram
   expr: LEVEL "top"
     [[ "yield"; e1 = expr LEVEL "simple";
        "continue"; e2 = expr LEVEL "simple" ->
           <:expr< [< $e1$; $e2$ >] >> ]];
END;;

$ ocamlc -c -I +camlp4 -pp camlp4of ext.ml
$ camlp4o ./ext.cmo -str 'yield e1 continue e2'
Stream.lapp (fun _ -> e1) (Stream.slazy (fun _ -> e2))
			
========================================================================
5) ODT: a *new* OCaml IDE integrated into Eclipse
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
f27402d82fe0ced8/a387499f680377f0#a387499f680377f0>
------------------------------------------------------------------------
** Emmanuel Dieul announced:

Here is the first version of the ODT (OCaml Development Tools) project.
It aims to be like the JDT plugins, which is the most famous IDE for
Java applications development into Eclipse... but ODT is not yet so
advanced ;-)

Everything is available on the ODT website: <http://ocamldt.free.fr>.
The "overview" page explains its current main features, and the
"install notes" page details some requirements and incompatibilities.
Some screenshots are also available to show the GUI.

Please, don't hesitate to try ODT (for personal or professional use)
and forward this mail to anyone which could be interested in.
			
** Dmitry Bely asked and Emmanuel Dieul answered:

 > How does it differ from ocamlfp
 > (<http://eclipsefp.sourceforge.net/ocaml/>)? Its Haskell part  
seems to
 > be actively developed, although the Ocaml one is untouched for more
 > than a year.
 >
 > - Dmitry Bely

I shortly used this plugin and I was a little bit desapointed. Some  
points
were quite difficult for me:
- I didn't have a human readable outline,
- the syntax highlighting was not implemented very well (.mll  
and .mly files
   not supported),
- there was no automatic compilation (am I wrong ?),
- ...

I also noticed that the last release on sourceforge was 3 years old.  
I started
to look at the source code and tried to adapt it, but it asked too  
much work
than rewriting it from scratch. That's why ODT was born.
			
** Dmitry Bely then asked and Soutaro Matsumoto answered:

 > Are you planning any
 > support for refactoring  (renaming at least)?

I am working for refactoring editor(it is funded by Google Summer of
Code 2007). I am working on my own plugin (it is not ODT).
We need parser, code formatter, and program transformater for
refactoring any way. I will make them so portable that ODT(or some other
programs) can use.
			
========================================================================
6) Polymorphic variant difference...
Archive: <http://groups.google.com/group/fa.caml/browse_frm/thread/ 
2277159276eede23/c92bc0294e7ccf73#c92bc0294e7ccf73>
------------------------------------------------------------------------
** Till Varoquaux asked, David Allsopp added, and Jacques Garrigue  
answered:

 > > Given a polymorphic variant type t with a label `B how does one  
build
 > > the type corresponding to t without the label `B.
 >
 > So that you could write something like:

 > type t = [ `A | `B | `C ]

 > let f x =
 >   match x with
 >     `B                     -> (* x has type t *)
 >   | #(t minus [ `B ]) as x -> (* x has type [ `A | `C ] *)

 > I end up having to write lots of tedious extra types to achieve that
 > normally... I'd find a subtraction syntax very handy too.


There is no theoretical difficulty in adding this (when t is defined),
but this would mean yet more syntax...
I would be curious to see code where this becomes such a pain.
In my view, having to name this type should help clarity.

 > On a similar subject, am I the only person who finds I often need  
to take a
 > fixed polymorphic variant value and coerce it so that it can just  
accept
 > more constructors e.g. (seriously contrived example)...
 > type t = [ `A | `B | `C ]

 > let f (x : t) =
 >   match x with
 >     `A -> `D
 >   | _  -> (x : t :> [> t ])

 > Something more concise than (x : t :> [> t ]) would be nice: e.g.  
(x ::> t)
 > But perhaps that really is a job for camlp4!


Indeed, this one is just about syntactic sugar, so camlp4 can do it.
An alternative without new syntax would be to let
   (x :> [> t]) mean (x : [< t] :> [> t]),
but this would break the invariant that coercions always work when the
coerced value is already an instance of the target type (not that
anybody uses this invariant...)
			
========================================================================
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/20070515/03707a05/attachment.pgp 


More information about the caml-news-weekly mailing list