Browse thread
menhir
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] menhir |
On Wed, 2007-05-02 at 20:35 +0200, Francois Pottier wrote: > On Thu, May 03, 2007 at 02:29:17AM +1000, skaller wrote: > > Yes, but you cannot write functions that take a state argument > > because lexbuf is a fixed data type and there's no where to > > add in any user state data. > > But my point is that you never need to pass a state argument to a parser > function. Instead, you can just have the function capture the address of the > (mutable) state in its closure. And mine is that you can't do that because the function is generated with a fixed signature, whose only state data is the lexbuf. Joel pointed out this isn't so, if you use a functor and construct it locally, then a 'global' variable of the functor is actually localised: I admit I didn't think of local dynamic instantiation. -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net