Version française
Home     About     Download     Resources     Contact us    
Browse thread
[ANN] ocamlscript 1.99
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David MENTRE <david.mentre@g...>
Subject: [ANN] ocamlscript 1.99
[ On behalf of Martin Jambon which has some issues with caml-list@. ]

Dear caml-list,

We are pleased to announce a pre-release of the future ocamlscript 2.
Ocamlscript allows to write single-file programs that include their own
compilation options and run fast thanks to ocamlopt.

Ocamlscript is simply a command-line tool which takes a single input
file, compiles it and runs it.

1) Key concepts:
- one source file contains everything (no more tar.gz or makefiles);
- programs run fast (unlike scripts using the "ocaml" command);
- programs are recompiled when needed (based on last modification
dates).


2) Novelties

A script is now composed of two parts:
- a short header which is written in OCaml and that is used to set
   compilation options (packages to use, compiler options, a special
   preprocessing, or even a completely different compiler to use
   instead of ocamlopt);
- the program itself.

By default, the program is compiled with ocamlopt and camlp4o as
preprocessor, but this can be changed.

This new version is not 100% compatible with the last release of
ocamlscript (1.1). It only concerns specific cases, i.e. scripts that require
exactly one cmx or cmxa file with no other option.


3) A complete example

Real example: a CGI script which uses the PCRE-OCaml,
Ocamlnet (cgi package) and Micmatch_pcre libraries.

The syntax extension provided by Micmatch_pcre is automatically loaded.
PCRE-OCaml (pcre package) is automatically loaded as a dependency of
Ocamlnet and Micmatch_pcre. So the script simply needs to start like
this:

#!/usr/bin/env ocamlscript
Ocaml.packs := ["micmatch_pcre"; "cgi"]
--
...

The full source code is there:
   http://martin.jambon.free.fr/examples/domains.ml.html

The resulting CGI executable is running as:
   http://wikiomics.org/cgi-bin/cgi/domains



4) Development status

This is the pre-release 1.99.0 of the future ocamlscript 2. It is
provided without a true documentation, and some aspects of the interface could
change until the 2.0 release.

User input will be greatly appreciated (see wiki below).


5) Distribution

OCamlscript was written by David Mentré (original version) and Martin
Jambon (latest features). It is distributed under the terms of the Boost
software license.

Source code:
   http://martin.jambon.free.fr/ocaml.html#ocamlscript

Wiki page for comments, questions and more:
   http://ocaml.pbwiki.com/Ocamlscript


Have fun!


The ocamlscript developers.
--
Martin Jambon, PhD
http://martin.jambon.free.fr