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 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 701ABBC0B for ; Mon, 15 Jan 2007 06:56:19 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0F5uGYH012024 for ; Mon, 15 Jan 2007 06:56:18 +0100 Received: from ppp14-213.lns2.syd7.internode.on.net (HELO rosella) ([59.167.14.213]) by ipmail02.adl2.internode.on.net with ESMTP; 15 Jan 2007 16:26:14 +1030 X-IronPort-AV: i="4.13,186,1167571800"; d="scan'208"; a="71620349:sNHT33200454" Subject: Re: [Caml-list] Ocaml compiler features From: skaller To: Jon Harrop Cc: caml-list@yquem.inria.fr In-Reply-To: <200701142049.57959.jon@ffconsultancy.com> References: <45A87011.8080203@gmail.com> <200701141823.32855.jon@ffconsultancy.com> <20070114184148.GA26213@snarc.org> <200701142049.57959.jon@ffconsultancy.com> Content-Type: text/plain Date: Mon, 15 Jan 2007 16:56:07 +1100 Message-Id: <1168840567.20477.49.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45AB1780.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 compiler:01 camlp:01 ocaml:01 camlp:01 haskell:01 overloading:01 infix:01 recursive:01 parsing:01 syntax:01 overloading:01 rtti:01 decoding:01 decoding:01 On Sun, 2007-01-14 at 20:49 +0000, Jon Harrop wrote: > > I think camlp4 is the not the proper way to extends the language, and is > > definitevely *NOT* going to improve the world of OCaml. > > Camlp4 may be the best we have. I can't wait to see the next generation... > > Playing with Haskell and F# has opened my eyes a bit. F#'s operator > overloading and active patterns will make my code much nicer. Felix has 'user defined syntax' which includes infix operators, outfix operators (brackets), and arbitrary statements. Arbitrary extensions to expressions aren't supported yet. However the system isn't really as good as Camlp4: if user grammar productions are overloaded, then because the system uses recursive descent parsing error handling is weak (an unoverloaded production is handled as a special case, so left factoring is recommended). Caml p4 allows almost arbitrary intervention in the grammar, and the action rules are arbitrary Ocaml -- felix only allows syntax macros (which are Turing complete but macros just don't cut it compared to explicit code generation for complex cases). Of course, Felix has function overloading (which subsumes operator overloading). I'm curious what active patterns are. Is that using RTTI to decode expressions at run time? Like a strong form of C++ 'dynamic cast'? (or, an extension of variant decoding, which after all is also using a variant tag for run time decoding). BTW: the *major* problem with all code generators is error handling. It's very easy to add 'sugar' to a language in the form of rewrite rules .. it is much harder to handle errors, because they might occur either in the desugaring OR in subsequent processing (eg type checking). Since the subsequent processing uses the desugared form of the code, it is hard to refer properly to the location of the error. Mind you .. HM type inference has this problem too. -- John Skaller Felix, successor to C++: http://felix.sf.net