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.2 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 11B55BC0C for ; Thu, 21 Dec 2006 21:21:43 +0100 (CET) Received: from host15.ipowerweb.com (host15.ipowerweb.com [66.235.219.115]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBLKLfDq012104 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 21 Dec 2006 21:21:42 +0100 Received: from c-24-9-123-251.hsd1.co.comcast.net ([24.9.123.251] helo=apotheon.com) by host15.ipowerweb.com with esmtp (Exim 4.52) id 1GxUQ3-0003F4-J4; Thu, 21 Dec 2006 12:21:37 -0800 Received: by apotheon.com (Postfix, from userid 1000) id DCCC9333CC; Thu, 21 Dec 2006 13:21:15 -0700 (MST) Date: Thu, 21 Dec 2006 13:21:15 -0700 From: Chad Perrin To: skaller Cc: Chad Perrin , caml-list@inria.fr Subject: Re: [Caml-list] Scripting in ocaml Message-ID: <20061221202115.GF9440@apotheon.com> References: <6dbd4d000612201941wcd4b09anc503a13889576512@mail.gmail.com> <20061221153413.8f99e8ed.mle+ocaml@mega-nerd.com> <1166685756.5337.4.camel@rosella.wigram> <20061221091824.GF2565@apotheon.com> <1166696955.5372.8.camel@rosella.wigram> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1166696955.5372.8.camel@rosella.wigram> User-Agent: Mutt/1.5.13 (2006-08-11) X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host15.ipowerweb.com X-AntiAbuse: Original Domain - inria.fr X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - apotheon.com X-Source: X-Source-Args: X-Source-Dir: X-Miltered: at discorde with ID 458AECD5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 bytecode:01 syntax:01 syntax:01 statically:01 notation:01 cetera:98 wrote:01 wrote:01 binaries:01 dynamically:01 typing:01 typing:01 caml-list:01 On Thu, Dec 21, 2006 at 09:29:15PM +1100, skaller wrote: > On Thu, 2006-12-21 at 02:18 -0700, Chad Perrin wrote: > > On Thu, Dec 21, 2006 at 06:22:36PM +1100, skaller wrote: > > > > The big problem using Ocaml (bytecode) for scripting > > > is probably the ugly dynamic loading support, and > > > for long running systems, the lack of unloading support. > > > (plus the syntax which isn't really well suited to small > > > scale scripting applications). > > > > Actually, I find that static typing is the biggest problem I have with > > administration script writing in OCaml. It can be great for bigger > > projects where dynamic typing doesn't always scale (as you mentioned), > > but for something under thirty lines of code (to pick a number out of > > thin air) the syntax requirements imposed by static typing and the > > semantic gymnastics that must sometimes be done (string_of_int, et > > cetera) can get in the way a bit. > > If you examine your > scripting code I'm going to bet you find that most variables > actually have a single statically known type! Actually, I typically don't even use variables in small OCaml scripts. I occasionally use "let n =", but don't find need to do the reference thing very often when the body of code is kept small. The most common problem I have with static typing getting in the way is having to decide on either multiple print statements or constructing a string from several different data types to use a single print statement. Where something like that takes one short line of code in the dynamically typed languages I'm used to using, it can be half my code when doing something similar in an OCaml script. Plus, y'know, list handling is easier for me in Perl or UCBLogo, with the former providing better general purpose text processing capability and the latter having an attractive prefix notation functional syntax (among other benefits). Neither compiles to persistent executable native binaries, though, which (combined with its high level syntax and several other means of running OCaml code) is really my main reason for liking OCaml. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] print substr("Just another Perl hacker", 0, -2);