Version française
Home     About     Download     Resources     Contact us    
Browse thread
Handling include files using ocamllex
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Handling include files using ocamllex
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 <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net