From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 2C103BB83 for ; Thu, 20 Jul 2006 07:16:34 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6K5GXUj022085 for ; Thu, 20 Jul 2006 07:16:33 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id HAA28586 for ; Thu, 20 Jul 2006 07:16:32 +0200 (MET DST) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k6K5GUSI022036 for ; Thu, 20 Jul 2006 07:16:31 +0200 Received: from rosella (ppp44-64.lns2.syd6.internode.on.net [59.167.44.64]) by ash25e.internode.on.net (8.13.6/8.13.5) with ESMTP id k6K5GISu001630; Thu, 20 Jul 2006 14:46:19 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: On language extensions (was Re: [Caml-list] global record) From: skaller To: Eric Breck Cc: caml-list@inria.fr In-Reply-To: <51E3580C-02A1-4344-A5AA-862B580015F1@cs.cornell.edu> References: <51E3580C-02A1-4344-A5AA-862B580015F1@cs.cornell.edu> Content-Type: text/plain; charset=utf-8 Date: Thu, 20 Jul 2006 15:16:18 +1000 Message-Id: <1153372578.18872.13.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 44BF11B1.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 44BF11AE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; buenzli:01 author's:01 locality:01 locality:01 syntax:01 ocaml:01 model:01 syntax:01 implements:01 ocamldoc:01 metaocaml:01 ocaml:01 dependencies:01 2006:98 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Wed, 2006-07-19 at 21:12 -0400, Eric Breck wrote: > > From: Daniel_Bünzli > If I have to read someone else's code I want to > > read caml code and not caml code augmented with the author's > > syntactic obsessions. > Succinctness is not precisely what I was after so much as locality - > Such locality is a basic principle of software engineering, > and in this case I don't really know how to achieve it with only a > library (and not a syntax extension). In my opinion, the difficulty here lies in the Ocaml programming model. Precisely as you say above regarding locality .. the syntax extensions should be localised. In particular, they should be embedded in the file that uses them -- along with documentation -- and not specified on the command line. For example syntax MyExtensions;; which could itself be implemented in ocamlp4 perhaps, and then *that* extension converted to a builtin part of the language. Felix implements syntax extensions with preprocessor statements (which can be provided in a #included file). Of course the syntax extension should contain documentation! Having said that, I do agree excessive extensions make code hard to read .. and probably defeat other tools such as ocamldoc (which even if applied to expanded output may report on the expanded source when one would prefer reporting on the unexpanded input). This form of code generation is weak compared with systems like MetaOcaml. Similarly, Ocaml should have import List;; .. List.fold_left .. so that you are required to import a separately compiled module before using it. As a sop to existing code, open List;; could imply import. grep for either 'open' or 'import' is then enough to establish dependencies. -- John Skaller Felix, successor to C++: http://felix.sf.net