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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 0B66ABB83 for ; Wed, 19 Jul 2006 21:41:17 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6JJfGwj008811 for ; Wed, 19 Jul 2006 21:41:16 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA19957 for ; Wed, 19 Jul 2006 21:41:16 +0200 (MET DST) Received: from mail14.bluewin.ch (mail14.bluewin.ch [195.186.19.62]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6JJfF6F008806 for ; Wed, 19 Jul 2006 21:41:15 +0200 Received: from [10.0.1.2] (85.1.184.187) by mail14.bluewin.ch (Bluewin 7.3.110.2) id 44925518006FAFAC for caml-list@inria.fr; Wed, 19 Jul 2006 19:41:15 +0000 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <67EBB7A9-9294-4783-BF44-E29651EA6E5F@epfl.ch> Content-Transfer-Encoding: 7bit From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Subject: On language extensions (was Re: [Caml-list] global record) Date: Wed, 19 Jul 2006 21:41:46 +0200 To: list caml-list X-Mailer: Apple Mail (2.752.2) X-Miltered: at nez-perce with ID 44BE8ADC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44BE8ADB.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 epfl:01 syntax:01 syntax:01 semantics:01 author's:01 trade-off:01 camlp:01 camlp:01 coq:01 ocaml's:01 cheers:01 ocaml:01 ocaml: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 Hello, I would like to issue a warning about everybody rolling its own syntax extension to suit its taste. Contrary to lisp's macros, each syntax extension is syntactically a new language. Hence not only do we need to learn a new semantics but also a new syntax. 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. In code readability, there is a trade-off between succinctness and syntactic regularity. Camlp4 extensions increase the former but decrease the latter. For me camlp4's usage should be limited to real domain specific languages (e.g. like coq does) and research, it should not be used to increase ocaml's succinctness. This may be seen as a matter of personal taste: it is true that I lean towards syntactic regularity, i.e. less syntactic constructs. However there is another argument against using extensions: code maintenance. You have no guarantee that (1) an extension will not be broken by the next version of the language and (2) that the author will continue to maintain it. And by the way, are we guaranteed that two arbitrary camlp4 extensions will compose or may the order of application matter ? Cheers, Daniel P.S. Even for domain specific languages many things can be done in pure ocaml by embedding the dsl in ocaml using meta-programming techniques.