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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 1EE4DBC57 for ; Fri, 25 Jun 2010 10:48:46 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApUBAB4KJExRZ90vkWdsb2JhbACfQRUBAQEBCQsKBxEDH8E6hSEE X-IronPort-AV: E=Sophos;i="4.53,480,1272837600"; d="scan'208";a="62112329" Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by mail1-smtp-roc.national.inria.fr with ESMTP; 25 Jun 2010 10:48:45 +0200 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100625084845.BBMQ3266.mtaout01-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Fri, 25 Jun 2010 09:48:45 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout02-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100625084845.ZKSG1586.aamtaout02-winn.ispmail.ntl.com@romulus.metastack.com>; Fri, 25 Jun 2010 09:48:45 +0100 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o5P8mcul027043 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Fri, 25 Jun 2010 09:48:38 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%11]) with mapi; Fri, 25 Jun 2010 09:48:32 +0100 From: David Allsopp To: bluestorm , Florent Ouchet Cc: caml users Subject: RE: [Caml-list] OCaml 3.12.0+beta1 Thread-Topic: [Caml-list] OCaml 3.12.0+beta1 Thread-Index: AQETBuuXac6dxJfWAlMXNU075oCXa5QA40MAgACIKQCAABScAIAAC1mAgAATkACAAAIWAIAAEyYAgACDBwCAAAg1AIAAH8QAgAAVSaA= Date: Fri, 25 Jun 2010 08:48:31 +0000 Message-ID: References: <4C232778.2020605@imag.fr> <4C2399B0.4060503@ens-lyon.org> <20100624205906.48451eor602oaf3u@webmail.imag.fr> <20100624224944.91886zxkgzxq78iw@webmail.imag.fr> <20100625000544.142418fa5cp6ye9k@webmail.imag.fr> <20100625082404.19864c8w6r8962kk@webmail.imag.fr> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=1ggfb5FlKZQUfF3vzm9UBYZ2uTfLsbs/8dSljwg5+mE= c=1 sm=0 a=q8OS1GolVHwA:10 a=kj9zAlcOel0A:10 a=DkDEmZqpHGIy8zE5VqgA:9 a=xWtB8vZ8bcHoszmffOh1XQ_Ff0sA:4 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; ocaml:01 camlp:01 ocaml:01 compiler:01 syntax:01 syntax:01 compiler:01 camlp:01 ocamldoc:01 showstopper:01 makefile:01 tarball:01 compilation:01 regexp:01 regexp:01 bluestorm wrote: > Here is a small Camlp4 filter removing exhaustive patterns. It obviously = depends on 3.12. > >=20 > > Notes : > - that the OCaml printer expand sugared { a; b } patters into { a =3D a; = b =3D b } is necessary=20 > for printing backward-compatible code; I'm not sure it's a good idea to r= ely on this. If *your* code has to be *backwards*-compatible with the OCaml 3.11.x compi= ler then you shouldn't be using that shorthand at all - the point with the = {; _} syntax is that it's necessary to suppress a warning in OCaml 3.12 whi= ch isn't present in 3.11 (in other words, that syntax has to be used in 3.1= 2 as I'm sure we all agree that any well-written piece of code should never= emit compiler warnings). Any features in 3.12 shouldn't be being used at a= ll *if* 3.11 compatibility is your goal. > - as with every camlp4 filters, the code is parsed then pretty-printed; d= o not expect indentation > to stay as is. Comment placement is also going to do weird things (know = and nearly-unfixable camlp4 defect) Seems fine. > : ocamldoc may not work properly on the output code. Sounds like a showstopper for most packages as that would break doc/docs Ma= kefile targets (shame, because a camlp4 script seems the obvious way to do = it). Presumably any package that's going to be written for 3.12 but aim to = compile on 3.11.x is going to have to .311.ml files (or some such scheme) g= enerated for the sources tarball and then have those selected by a configur= e script when it detects OCaml 3.11.x or earlier (similar scheme to support= ing 3.09- camlp4 and 3.10+ camlp4). If camlp4 sadly can't do it reliably, h= ow about combining the sed suggestion you made: sed -e "s/; *_ *}/}/g" with a test compilation in OCaml 3.11 to pick up any instances where line-b= reaking has been a problem (in other words, change your coding conventions = and use the compiler to check that they've been adhered to)? It's not a par= ticularly hard sed[*] script to read a few lines at a time and change the r= egexp to "s/;[ \t\n]*_[ \t\n]*}/}/g" to handle different line breaking conv= entions as well (and you could insert an additional regexp to handle non-ne= sted comments in that gap as well). That would have the benefit of not mess= ing up ocamldoc comments. As an aside, while it seems fair enough that a pre-processor such as camlp4= may mess up *comments* it seems to me a bug that it messes up ocamldoc *in= structions* (which are reasonably viewable as a functional part of your cod= e). But is that a well-rehearsed argument about a really unfixable problem? David [*] or substitute your favourite text processor here!