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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id C9C7FBC69 for ; Sun, 5 Aug 2007 12:16:38 +0200 (CEST) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l75AGaor004758 for ; Sun, 5 Aug 2007 12:16:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAANY+tUZ5LGJp/2dsb2JhbAAN X-IronPort-AV: E=Sophos;i="4.19,221,1183300200"; d="scan'208";a="167297451" Received: from ppp121-44-98-105.lns10.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.98.105]) by ipmail01.adl2.internode.on.net with ESMTP; 05 Aug 2007 19:46:35 +0930 Subject: Re: [Caml-list] Handling include files using ocamllex From: skaller To: Erik de Castro Lopo Cc: caml-list@inria.fr In-Reply-To: <20070805145238.76aed5d6.mle+ocaml@mega-nerd.com> References: <20070802200933.3621fb1a.mle+ocaml@mega-nerd.com> <1186060770.23889.39.camel@rosella.wigram> <20070805145238.76aed5d6.mle+ocaml@mega-nerd.com> Content-Type: text/plain Date: Sun, 05 Aug 2007 20:16:34 +1000 Message-Id: <1186308994.9925.132.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46B5A384.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocamllex:01 generalise:01 compilation:01 sourceforge:01 wrote:01 preprocessor:01 preprocessor:01 caml-list:01 constructor:01 data:02 data:02 functional:02 algebraic:03 seems:03 conditional:04 On Sun, 2007-08-05 at 14:52 +1000, Erik de Castro Lopo wrote: > I tried that with a class and ran into all sorts of problems > related to trying to use instance data in the constructor. You should share that experience here. It's hard to know when to go for a class and when a simpler algebraic data structure is better, so user experience reports (use cases) are valuable data. > In the end, I ditched the class/object but kept your idea > and approached it from a more functional direction which > resulted in this (filename lexstack.ml): > I haven't tested it as thoroughly as I should have, but the > general idea seems to work. Yep, it should. But you probably should generalise to support conditional compilation as well. Felix provides that facility. Preprocessor 'macro' symbols are never expanded in the source code, only in preprocessor directives. Even very basic facility is fairly general and can be used to solve porting problems as a fallback if other more well disciplined techniques fail. -- John Skaller Felix, successor to C++: http://felix.sf.net