Previous week   Up   Next week
Hello,

Here is the latest Caml Weekly News, week 01 to 08 April, 2003.

1) Our shrinking Humps
2) C++ embedded ocaml and shared libraries
3) Wanted - General Purpose "Glue Logic" Data-Structures
4) dynamic HTML pages

======================================================================
1) Our shrinking Humps
----------------------------------------------------------------------
It all started with a message from Sergey Goldgaber (reported last
week). Here is an excerpt:

The Caml Humps are just a list of links.  There seems to be no real
archive of contributed OCaml code.  Because of this the community is
losing these contributions as linked web pages disappear (either
because of web-site reorganization, or because the people maintaining
those personal web sites have moved on to something else).

To this, Pierre Weis answered:
(start of thread: http://caml.inria.fr/archives/200304/msg00026.html)

INRIA can donate a server and the associated bandwidth. The problem is
then to find people that take care of this archive, since INRIA cannot
donate the additional man power to set up and maintain it.

Is there any volunteers ?

There were many answers, and Pierre Weis added:

Thank you everybody for being interested at maintaining a standalone
set of Caml software for the communauty.

I'm afraid I will not be able to set up the thing and answer to
everybody before the end of my vacations (during the full next
week). I will tell you more the week after!

> Err, i think the issue is more about if INRIA trust you to have an
> account inside their firewall or not. A security issue about trusting
> Joe Random Ocaml Developer.
> 
> Friendly,
> 
> Sven Luther

INRIA is a strange and complex house: we may have a machine inside
INRIA with all the corresponding facilities (no power failures, good
connectivity, full automatic backup), while maintaining this machine
outside the INRIA firewall (so, there is no way for you to connect
from this machine to a machine inside the INRIA network (even if it is
50 cm away from the machine you are logged in!)). By the way, there is
no ``Joe Random Ocaml Developer'' here: we will give accounts to
selected people only (trusted people I would say).

I was thinking of something like that, experimenting with a machine
outside our firewall and running a strong and secure OS (FreeBSD ?) to
have a very low maintenance cost.

Do you think this would be a reasonable solution ? Are there problems
I do not imagine ?

Maxence Guesdon proposed:

I was thinking about setting up a kind of "wiki humps", even before this
discussion, since I'm developing a tool to quickly develop wikis
(with more structure than just pages, that is "elements" with various
attributes, editable or not depending on who's connected and so on).

This way, each contributor updates information about his contribs.

The "wiki humps" would basically contain the same information as
the current humps, but could then be enhanced to handle a repository
of files.

Upload of OCamldoc-generated documentation could also be supported
to give an overview of each library's interface, and search through
all interfaces... Just an idea.

======================================================================
2) C++ embedded ocaml and shared libraries
----------------------------------------------------------------------
Ian Haycock asked and Rabih El Chaar answered:

> I'm trying to embed some ocaml code into a C shared library with C
> code.  I can produce a static library that does what I want, but I
> really need to get a shared library and all attempts I've made so far
> have failed.
> 
> Basically I'm trying to compile 2 ml source files into objects and
> then put these together with objects from C code, which call out to
> the caml code, into the shared library. However the library creation
> fails telling me there are multiply defined symbols (eg caml_startup)
> in the objects produced from   the 2 ml source files.
> 
> Can anybody give me a hint (or even better an example) as to how to do
> this.  The only examples I can find on the web relating to embedding
> ocaml in C and then creating a shared library involve 1 ml file and 1
> C file and in this instance I don't get the multiple symbol problem.
> 
> Any help appreciated

The problem is the following :

when you compile ml files into obj, a C file is created, with the
necessary byte code (compilation of the ml). It also defines function
such as startup for initializing your byte code into the gc.

If you have several ml files, you should do the following : compile .ml
into cmo.  join all the cmo with -linkall compiler options into a .obj.

use the resulting .obj (unique) for linking your dll.

This should work.

======================================================================
3) Wanted - General Purpose "Glue Logic" Data-Structures
----------------------------------------------------------------------
John Gerard Malecki searched for a data structure, Wheeler Ruml
answered, and Markus Mottl added:

> >   - fast computation of cardinality
> > 
> >   - fast addition of single elements
> > 
> >   - fast addition of lists of elements
> > 
> >   - fast removal of single elements in random order
> > 
> >   - not choking on a large data size
> 
> I saw Brian's recommendation of a priority queue, but wanted to
> mention that a resizable array would do here as well.  Eg, something
> like
> 
> type rarray = { a : 'a array; end : int; }
> 
> where you allocate more space than you need (or allocate to the
> correct size at the start, if you know it), doubling the size when
> necessary, and only look at those elements before the end.  Brian's
> queue may well do this underneath, but there's no reason to suffer
> O(log n) insertion and removal time if you don't really care about the
> order.  Just add to the end and swap with a random element in constant
> time.  Or remove from a random place and copy in the last element.
> The only tricky thing is to be careful to fill any "empty" cells in
> the array with the same dummy value (which needs to be supplied at
> creation time) so you don't prevent objects from being GC'ed.

The RES-library implements everything you need for that purpose and also
matches the signature of ordinary arrays:

  http://www.oefai.at/~markus/home/ocaml_sources.html#RES

======================================================================
4) dynamic HTML pages
----------------------------------------------------------------------
David Monniaux asked and Maxence Guesdon answered:

> I'm investigating solutions for generating dynamic HTML pages using OCaml
> programs. So far, I've looked at the following systems:
> 
> * OCamlNet/NetString can transform between a SGML/HTML parse tree and a
>   SGML/HTML file.
> 
>   This may be a solution; perhaps it would be better if there were some
>   camlp4 syntactic sugar for creating the parse tree nodes.
> 
>   Slight concern: the entire page must be fully generated between being
>   transmitted.
> 
> * Bedouin: interesting attempt at enforcing well-formedness through type
>   safety, but the project seems dead in the water.
> 
> * WDialog: isn't it a bit of overkill?
> 
> * Antoine Miné's OCamlHTML: a bit rudimentary.
> 
> Are there projects that I missed? Any experience?

Have a look at the toolhtml library, included in Cameleon:
http://pauillac.inria.fr/~guesdon/Tools/cameleon/cameleon.html

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

If you happen to miss a cwn, you can send me a message
(alan.schmitt@inria.fr) and I'll mail it to you, or go take a look at
the archive (http://pauillac.inria.fr/~aschmitt/cwn/). If you also wish
to receive it every week by mail, just tell me so.

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

Alan Schmitt