From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5C826BC0A for ; Thu, 21 Dec 2006 16:00:02 +0100 (CET) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBLF013F027734 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 21 Dec 2006 16:00:02 +0100 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1GxPOk-0006se-00; Thu, 21 Dec 2006 14:59:54 +0000 Date: Thu, 21 Dec 2006 14:59:54 +0000 To: Denis Bueno Cc: OCaml Mailing List Subject: Re: [Caml-list] Scripting in ocaml Message-ID: <20061221145953.GA24045@furbychan.cocan.org> References: <6dbd4d000612201941wcd4b09anc503a13889576512@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6dbd4d000612201941wcd4b09anc503a13889576512@mail.gmail.com> User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at discorde with ID 458AA171.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 camlp:01 syntax:01 foo:01 foo:01 camlp:01 syntax:01 pipelines:01 20,:98 blog:98 blog:98 wrote:01 caml-list:01 usable:01 On Wed, Dec 20, 2006 at 10:41:20PM -0500, Denis Bueno wrote: > I've been writing bash scripts to perform various build- and > development-related tasks, and I don't enjoy it. I won't bore you with > detailed reasons why. The upshot is that I'd like to script in OCaml. > > I have considered writing a few camlp4 extensions to make it easier to > write scripts: > > 1) create a syntax which grabs environment variables: > > e.g. $FOO would grab the value of the environment variable FOO > > 2) some sort of more convenient process interaction, e.g., for piping. I think it's a great idea - I'd love to push OCaml for scripting. However I hope your camlp4-fu is up to snuff. You'd want, as you say, a syntax for pipelines and file redirection, but more importantly you'd want a very simple syntax for running commands. So you can write some unholy OCaml/sh combination like: let nr_files = int_of_string ` ls | wc -l ` Actually, even Perl isn't a very usable alternative for shell scripting because of the amount of code you have to write just to fork off a command and capture the output. Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Internet Marketing and AdWords courses - http://merjis.com/courses - NEW! Merjis blog - http://blog.merjis.com - NEW!