English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[announce] ocamlscript 1.0
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-08-22 (22:51)
From: David MENTRE <dmentre@l...>
Subject: [announce] ocamlscript 1.0

I've just released ocamlscript 1.0. ocamlscript is the very very small
implementation of a simple idea: write shell-like scripts on a Unix
system but in OCaml and optimized for speed.

For example, you can have a file with following content:

--start execute-n-times--
#!./ocamlscript unix.cmxa

let times = int_of_string (Sys.argv.(1))
let program = Sys.argv.(2)

let _ =
  for i = 1 to times do
    ignore(Unix.system program)

  exit 0
--end execute-n-times--

And execute this script as:
 ./execute-n-times 10 'echo Hello world!'

When this script is executed ("./execute-n-times"), the first time it is
compiled into native code ("./execute-n-times.opt") and then
executed. At second execution, the native code is executed
immediately. Of course, if the original script is modified, the native
code version is automatically recompiled.

A nice project (and from where the original idea of ocamlscript comes
from) would be to do a Linux distribution where all usual shell scripts
are replaced by ocamlscript scripts. I probably won't do it. ;)

Source: http://www.linux-france.org/~dmentre/code/ocamlscript-1.0.tar.gz

License: Public Domain

Have fun! ;)
pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <dmentre@linux-france.org>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A